Exercise: Questions on Misc


Questions on 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.
Show Answer
Questions on Misc : 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
Show Answer
Questions on Misc : Question 3 :
The number of tokens in the following C statement is (GATE 2000)
printf("i = %d, &i = %x", i, &i);

3
26
10
21
Show Answer
Questions on Misc : Question 4 :
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
Show Answer
Questions on Misc : Question 5 :
Assume that the size of an integer is 4 bytes. Predict the output?
#include <stdio.h>
int fun()
{
    puts(" Hello ");
    return 10;
}

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

4
Hello 4
4 Hello
Compiler Error
Show Answer
Questions on Misc : Question 6 :
#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
Show Answer
Questions on Misc : Question 7 :
Consider line number 3 of the following C- program.
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
Show Answer
Questions on Misc : Question 8 :
Consider a program P that consists of two source modules M1 and M2 contained in two different files. If M1 contains a reference to a function defined in M2, the reference will be resolved at

Edit-time
Compile-time
Link-time
Load-time
Show Answer
Questions on Misc : Question 9 :
Assume the following C variable declaration
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
Show Answer
Questions on Misc : Question 10 :
Consider the following C program:
# include <stdio.h>
int main( )
{
   int i, j, k = 0;
   j = 2 * 3 / 4 + 2.0 / 5 + 8 / 5;
   k  -= --j;
   for (i = 0; i < 5; i++)
   {
      switch(i + k)
      {
         case 1:
         case 2: printf("\n%d", i + k);
         case 3: printf("\n%d", i + k);
         default: printf("\n%d", i + k);
      }
   }
   return 0;
}
The number of times printf statement is executed is __________.

8
9
10
11
Show Answer