C Quiz - 103

Last Updated :
Discuss
Comments

Question 1

"Why is the & (address-of) operator used with scanf() when reading integer values?

  • To specify the format of the input.

  • To store the input at the variable’s memory address.

  • To perform pointer arithmetic.

  • It is optional and does not affect the function’s behavior.

Question 2

For a given integer, which of the following operators can be used to “set” and “reset” a particular bit respectively?
  • | and &
  • && and ||
  • & and |
  • || and &&

Question 3

What’s going to happen when we compile and run the following C program snippet? C
#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.

Question 4

What’s going to happen when we compile and run the following C program snippet?

C
#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 behavior

  • Compiler Error due to missing argument for second %d

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

  • sizeof elseif make

  • make main elseif

  • make main

  • auto make

  • None of the above is keywords in C.

Tags:

There are 5 questions to complete.

Take a part in the ongoing discussion