Exercise: Questions on C Quiz 3


Questions on C Quiz 3 : Question 1 :
For a given integer, which of the following operators can be used to “set” and “reset” a particular bit respectively?

| and &
&& and ||
& and |
|| and &&
Show Answer
Questions on C Quiz 3 : Question 2 :
What’s going to happen when we compile and run the following C program snippet?
#include "stdio.h"
int main()
{
 int a = 10;
 int b = 15;

 printf("=%d",(a+1),(b=a+2));
 printf(" %d=",b);

 return 0;
}

=11 15=
=11 12=
Compiler Error due to (b=a+2) in the first printf().
No compile error but output would be =11 X= where X would depend on compiler implementation.
Show Answer
Questions on C Quiz 3 : Question 3 :
What’s going to happen when we compile and run the following C program snippet?
#include "stdio.h"
int main()
{
 int a = 10;

 printf("=%d %d=",(a+1));

 return 0;
}

=11 0=
=11 X= where X would depend on Compiler implementation
Undefined behaviour
Compiler Error due to missing argument for second %d
Show Answer
Questions on C Quiz 3 : Question 4 :
Which of the following functions from “stdio.h” can be used in place of printf()?

fputs() with FILE stream as stdout.
fprintf() with FILE stream as stdout.
fwrite() with FILE stream as stdout.
All of the above three - a, b and c.
In “stdio.h”, there’s no other equivalent function of printf().
Show Answer
Questions on C Quiz 3 : Question 5 :
As per C language standard, which of the followings is/are not keyword(s)? Pick the best statement. auto make main sizeof elseif

None of the above is keywords in C.
make main elseif
make main
auto make
sizeof elseif make
Show Answer