C Quiz - 103

Last Updated :
Discuss
Comments

Question 1

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

  • A

    To specify the format of the input.

  • B

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

  • C

    To perform pointer arithmetic.

  • D

    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?
  • A
    | and &
  • B
    && and ||
  • C
    & and |
  • D
    || 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;
}
  • A
    =11 15=
  • B
    =11 12=
  • C
    Compiler Error due to (b=a+2) in the first printf().
  • D
    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;
}
  • A

    =11 0=

  • B

    =11 X= where X would depend on Compiler implementation

  • C

    Undefined behavior

  • D

    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

  • A

    sizeof elseif make

  • B

    make main elseif

  • C

    make main

  • D

    auto make

  • E

    None of the above is keywords in C.

Tags:

There are 5 questions to complete.

Take a part in the ongoing discussion