wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Basic testing

Total questions: 25

Worksheet time: 25mins

Name
Class
Date
1.

Who is the father of C language?

a)

Steve Jobs

b)

James Gosling

c)

Rasmus Lerdorf

d)

none of these

2.

Among the following Datatypes , Which Datatype stores integer value but gives wider range of values at the cost of taking more memory?

a)

float

b)

double

c)

long double

d)

long

3.

which keyword among the following can be used for both variables and functions?

a)

static

b)

unsigned

c)

typedef

d)

union

4.

What will be the output of the following code snippet?

#include <stdio.h>

int main()

{

int a = 3, b = 5;

int t = a;

a = b;

b = t;

printf("%d %d", a, b);

return 0;

}

a)

3 3

b)

3 5

c)

5 3

d)

5 5

5.

Which of the following is an exit controlled loop?

a)

do while loop

b)

for loop

c)

while loop

d)

none of these

6.

Which is valid C expression?

a)

int my_num = 100,000;

b)

int my_num = 100000;

c)

int my num = 1000;

d)

int $my_num = 10000;

7.

Which bitwise operator is suitable for turning on a particular bit in number?

a)

&& operator

b)

& operator

c)

|| operator

d)

| operator

8.

what is the output of this c code?

#include<stdio.h>

int main()

{

int i = 5;

i = i / 3;

printf("%d\n" , i );

return 0;

}

a)

Implementation defined

b)

3

c)

1

d)

compile time error

9.

what is the output of this c code?

#include<stdio.h>

int main()

{

int i = -3;

int k = i % 2;

printf("%d\n" , k );

return 0;

}

a)

none of these

b)

-1

c)

1

d)

compile time error

10.

what is the output of this c code?

#include<stdio.h>

void main()

{

int k = 8 ;

int x = 0 == 1 && k++;

printf("%d%d\n", x , k );

}

a)

0 8

b)

0 9

c)

1 9

d)

1 8

11.

what is the output of this c code?

#include<stdio.h>

void main()

{

unsigned int = -9;

printf("%d", x );

}

a)

1

b)

9

c)

-9

d)

compiler error

12.

what is the output of this c code?

#include<stdio.h>

int main()

{

int x = 2 , y = 3 ;

x / = x / y;

printf("%d\n", x );

return 0;

}

a)

none of these

b)

1

c)

2

d)

compiler error

13.

what would be the value of c?

#include<stdio.h>

int main ( )

{

int h ;

float a,b;

a= 245.08;

b= 78.03;

c = a + b;

}

a)

333.02

b)

323.98

c)

error

d)

323

14.

When do you need to use type-conversions?

a)

The value to be stored is beyond the max limit

b)

The value to be stored is in a form not supported by that data type

c)

To reduce the memory in use, relevant to the value

d)

All the above

15.

Which type of conversion is NOT accepted?

a)

From float to char pointer

b)

From negative int to char

c)

From double to char

d)

All the above

16.

Choose correct C while loop syntax

a)

while(condition); { //statements }

b)

{ //statements }while(condition)

c)

while(condition) { //statements }

d)

none of these

17.

What is the output of C Program.?

int main()

{

while(true)

{

printf("RABBIT");

break;

}

return 0;

}

a)

compiler error

b)

run time error

c)

no output

d)

RABBIT

18.

int main()

{

int k;

for(k=1; k <= 5; k++);

{

printf("%d ", k);

}

return 0;

}

what is the output ?

a)

1 2 3 4 5

b)

5

c)

6

d)

syntax error

19.

What is the way to suddenly come out of or Quit any Loop in C Language.?

a)

continue; statement

b)

break; statement

c)

leave; statement

d)

quit; statement

20.

Which of the following operators has an associativity from Right to Left?

a)

<=

b)

<<

c)

+=

d)

==

21.

Comment on the following statement.

n = 1;

printf("%d, %dn", 3*n, n++);

a)

none of these

b)

Output will be 3, 1

c)

Output will be 6, 1

d)

Output is compiler dependent

22.

which of the followings set are correct form of datatype, variable and constants combination.

a)

void,_main,099

b)

int, main_name, xyz

c)

none of these

d)

varchar,jkd,3ai

23.

Is the following statement correct?

Break statement is used in "for loop".

a)

true

b)

false

24.

A C program is basically a collection of-----------.C language is well suited for------------programming.

a)

program, platform oriented

b)

rules, dynamic

c)

codes, simple

d)

function, structure

25.

Is the following statement correct?

Goto statement can be used anywhere in the program to jump from its current execution to some other lines in the code

a)

true

b)

false