wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

A Quiz on C Programming

Total questions: 20

Worksheet time: 22mins

Name
Class
Date
1.

What is the output of the below code?

a)

Infinite loop

b)

Prints "Hello" once

c)

No output

d)

Compiler error

2.

How do you specify double constant 3.14 as a long double?

a)

By using LD after 3.14

b)

By using L after 3.14

c)

By using DL after 3.14

d)

By using LF after 3.14

3.

A macro can execute faster than a function.

a)

True

b)

False

4.

A pre-processor directive is a statement that begins with____

a)

{

b)

#

c)

//

d)

/*

5.

What will be the output of the program ?

a)

Hello

b)

World

c)

Hello World

d)

WorldHello

6.

What will be the output of the program ?

a)

A

b)

B

c)

C

d)

65

7.

Which of the following function sets first n characters of a string to a given character?

a)

strinit()

b)

strnset()

c)

strset()

d)

strcset()

8.

What will be the output of the program in 16 bit platform (Turbo C under DOS)?

a)

Garbage Value

b)

0 (Zero)

c)

1990

d)

No Output

9.

The keyword used to transfer control from a function back to the calling function is

a)

switch

b)

go to

c)

go back

d)

return

10.

How many times the program will print "GEC"?

a)

Infinite times

b)

32767 times

c)

65535 times

d)

Till stack overflows

11.

Point out the error in the program

a)

Missing parenthesis in return statement

b)

The function should be defined as int f(int a, int b)

c)

Redeclaration of a

d)

No error

12.

In mathematics and computer programming, which is the correct order of mathematical operators ?

a)

Addition, Subtraction, Multiplication, Division

b)

Division, Multiplication, Addition, Subtraction

c)

Multiplication, Addition, Division, Subtraction

d)

Addition, Division, Modulus, Subtraction

13.

Which of the following is the correct order of evaluation for the below expression? z = x + y * z / 4 % 2 – 1

a)

* / % + - =

b)

= * / % + -

c)

/ * % - + =

d)

* % / - + =

14.

In C, if you pass an array as an argument to a function, what actually gets passed?

a)

Value of elements in array

b)

First element of the array

c)

Base address of the array

d)

Address of the last element of array

15.

What will be the output of the program?

a)

2, 1, 15

b)

1, 2, 5

c)

3, 2, 15

d)

2, 3, 20

16.

What will be the output of the program?

a)

2, 3, 4, 5,

b)

1, 3, 2, 4,

c)

1, 2, 3, 4,

d)

3, 2, 1, 0,

17.

If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?

a)

.

b)

*

c)

&

d)

->

18.

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

a)

&&

b)

&

c)

||

d)

!

19.

What is the similarity between a structure, union and enumeration?

a)

All of them let you define new values

b)

All of them let you define new data types

c)

All of them let you define new pointers

d)

All of them let you define new structures

20.

How will you free the allocated memory?

a)

remove(var-name);

b)

free(var-name);

c)

delete(var-name);

d)

dalloc(var-name);