• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

C Misc

Question 1

In the C language (GATE CS 2002)
  • At most one activation record exists between the current activation record and the activation record for the main
  • The number of activation records between the current activation record and the activation record for the main depends on the actual function calling sequence.
  • The visibility of global variables depends on the actual function calling sequence.
  • Recursion requires the activation record for the recursive function to be saved on a different stack before the recursive function can be called.

Question 2

The C language is. (GATE CS 2002)
  • A context free language
  • A context sensitive language
  • A regular language
  • Parsable fully only by a Turing machine

Question 3

The number of tokens in the following C statement is

printf("HELLO WORLD");
  • 3

  • 5

  • 9

  • 8

Question 4

Assume that the size of an integer is 4 bytes. Predict the output? 

C
#include <stdio.h>
int fun()
{
    puts(\" Hello \");
    return 10;
}

int main()
{
    printf(\"%d\", sizeof(fun()));
    return 0;
}
  • 4

  • Hello 4

  • 4 Hello

  • Compiler Error

Question 5

Which of the following best describes C language
  • C is a low level language
  • C is a high level language with features that support low level programming
  • C is a high level language
  • C is a very high level language

Question 6

C
#include <stdio.h>
int main()
{
    int a[][3] = {1, 2, 3, 4, 5, 6};
    int (*ptr)[3] = a;
    printf(\"%d %d \", (*ptr)[1], (*ptr)[2]);
    ++ptr;
    printf(\"%d %d\\n\", (*ptr)[1], (*ptr)[2]);
    return 0;
}
  • 2 3 5 6
  • 2 3 4 5
  • 4 5 0 0
  • none of the above

Question 7

Assume the following C variable declaration 

C
int *A [10], B [10][10];

Of the following expressions

I.   A [2]
II.  A [2][3]
III. B [1]
IV.  B [2][3] 

which will not give compile-time errors if used as left hand sides of assignment statements in a C program ?

  • I, II and IV only

  • II, III and IV only

  • II and IV only

  • IV only

Question 8

Output of Below C Code? Assume that int takes 4 bytes. C
#include<stdio.h>
int x = 5;
int main()
{
	int arr[x];
	static int x = 0;
	x = sizeof(arr);
	printf(\"%d\", x<<2);
	return 0;
}
Thanks to Gokul Kumar for contributing this question.
  • Compiler error in line "static int x = 0"
  • 7
  • 80
  • 20

Question 9

C
#include <stdio.h>
#include <string.h>
int main()
{
    char a[] = {\'G\',\'E\',\'E\',\'K\',\'S\',\'Q\',\'U\',\'I\',\'Z\'};
    char b[] = \"QUIZ\";
    char c[] = \"GEEKS\";
    char d[] = \"1234\";
    int l = strlen(a);
    int o = printf(\"%d\", sizeof((sizeof(l)+(c[5]+d[0]+a[1]+b[2]))) );
    printf(\"%c\", a[o]);
    return 0;
}
Thanks to Gokul for contributing this question.
  • 4E
  • 8E
  • 1234Q
  • Compiler Dependent

Question 10

Consider line number 3 of the following C- program. 

C
int main ( ) {                   /* Line 1 */
  int I, N;                      /* Line 2 */
  fro (I = 0, I < N, I++);       /* Line 3 */
}

Identify the compiler\'s response about this line while creating the object-module

  • No compilation error

  • Only a lexical error

  • Only syntactic errors

  • Both lexical and syntactic errors

There are 25 questions to complete.

Last Updated :
Take a part in the ongoing discussion