C/C++ Online Test   

[Note : pass marks >= 70% ]


1. In C all functions except main() can be called recursively.
  1. True
  2. False
  3. none.

2. Bitwise can be used to reverse a sign of a number.
  1. Yes
  2. No
  3. none

3. Can a structure can point to itself?
  1. Yes
  2. No
  3. none

4. Which of the following operations are INCORRECT?
  1. int i = 35; i = i%5;
  2. short int j = 255; j = j;
  3. float a = 3.14; a = a%3;

5.Which of the following sentences are correct about a switch loop in a C program?

1: switch is useful when we wish to check the value of variable against a particular set of values.

2: switch is useful when we wish to check whether a value falls in different ranges.

3: Compiler implements a jump table for cases used in switch.

4: It is not necessary to use a break in every switch statement.

  1. 1,2
  2. 1,3,4
  3. 2,4

6. To print out a and b given below, which of the following printf() statement will you use?

#include <stdio.h >
float a=3.14;
double b=3.14;

  1. printf("%f %lf", a, b);
  2. printf("%Lf %f", a, b);
  3. printf("%Lf %Lf", a, b);

7. malloc() returns a NULL if it fails to allocate the requested memory.
  1. True
  2. False
  3. none

8. What will be the output of the program?

#include<stdio.h>
int main()
{
int y=128;
const int x=y;
printf("%d\n", x);
return 0;
}

  1. 128
  2. Garbage value
  3. 0





Score =

Status =

back



Designed
by www.pegarecruiter.com