Q. What will be the output of the following program ?

Code:
#include
void main()
{ int a = 2;
switchA.
{ case 1:
printf(“goodbye”); break;
case 2:
continue;
case 3:
printf(“bye”);
}
}
  • (A) goodbye
  • (B) bye
  • (C) byegoodbye
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (D) error

Q. What will be the output of the following statements ?

Code:
int i = 1,j; j=i— -2; printf(“%d”,j);
  • (A) -3
  • (B) 2
  • (C) 3
  • (D) error
πŸ’¬ Discuss
βœ… Correct Answer: (C) 3

Q. What will be the output of following program ?

Code:
#include
main()
{
int x,y = 10;
x = y * NULL;
printf(“%d”,x);
}
  • (A) 0
  • (B) 10
  • (C) error
  • (D) garbage value
πŸ’¬ Discuss
βœ… Correct Answer: (A) 0

Q. What will be the output of following statements ?

Code:
char x[ ] = “hello hi”; printf(“%d%d”,sizeof(*x),sizeof(x));
  • (A) 18
  • (B) 19
  • (C) 29
  • (D) 88
πŸ’¬ Discuss
βœ… Correct Answer: (B) 19

Q. What will be the output of the following statements ?

Code:
int a=5,b=6,c=9,d; d=(ac?1:2):(c>b?6:8)); printf(“%d”,D.;
  • (A) 1
  • (B) 2
  • (C) 6
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Error

Q. What will be the output of the following statements ?

Code:
int i = 3;
printf(“%d%d”,i,i++);
  • (A) 33
  • (B) 34
  • (C) 43
  • (D) 44
πŸ’¬ Discuss
βœ… Correct Answer: (C) 43

Q. What will be the output of the following program ?

Code:
#include
void main()
{
int a = 36, b = 9;
printf(“%d”,a>>a/b-2);
}
  • (A) 5
  • (B) 7
  • (C) 9
  • (D) None of these
πŸ’¬ Discuss
βœ… Correct Answer: (C) 9

Q. What value does testarray[2][1][0] in the sample code contain?

Code:
int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  • (A) 5
  • (B) 7
  • (C) 9
  • (D) 11
πŸ’¬ Discuss
βœ… Correct Answer: (D) 11

Q. What is the output?

Code:
void main()
{
int a=10,b=20;
char x=1,y=0;
if(a,b,x,y)
{
printf(“EXAM”);
}
}
  • (A) XAM is printed
  • (B) exam is printed
  • (C) Compiler Error
  • (D) Nothing is printed
πŸ’¬ Discuss
βœ… Correct Answer: (D) Nothing is printed

Q. What is the output of the following code?

Code:
#include
void main()
{
int s=0;
while(s++<10)>
# define a 10
main()
{
printf(“%d..”,A.;
foo();
printf(“%d”,A.;
}
void foo()
{
#undef a
#define a 50
}
  • (A) 0
  • (B) 10..10
  • (C) 10..50
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Error