wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Programming Quiz

Total questions: 87

Worksheet time: 1hrs 1mins

Name
Class
Date
1.

Which of the following is true for variable names in C

a)

Variable names cannot start with a digit

b)

Variable can be of any length

c)

They can contain alphanumeric characters as well as special characters

d)

Reserved Word can be used as variable name

2.

Which of these is NOT a relational or logical operator?

a)

=

b)

||

c)

==

d)

!=

3.

What is the scope of an external variable?

a)

Whole source file in which it is defined

b)

From the point of declaration to the end of the file in which it is defined

c)

Any source file in a program

d)

From the point of declaration to the end of the file being compiled

4.

The global variables are ____________.

a)

External

b)

internal

c)

both A & B

d)

None

5.

The #include is a ______________.

a)

Inclusion directive

b)

File inclusion directive

c)

Preprocessor directive

d)

None of the above

6.

Which of these properties of #define is false?

a)

These always obey the scope rules

b)

We can make use of a pointer to #define

c)

The #define can be externally available

d)

All of the above

7.

Pick the correct syntax for Ternary Operator in C from the options given below:

a)

condition < expression1 ? expression2

b)

condition ? expression1 < expression2

c)

condition : expression1 ? expression2

d)

condition ? expression1 : expression2

8.

Find the output of the given C statement. void main(){ int p=0; p = 5<2 ? 4 : 3; printf("%d",p); }

a)

2

b)

5

c)

3

d)

4

9.

Find a C Storage Class below

a)

static

b)

auto

c)

register & extern

d)

All the above

10.

How many keywords are there in C Language?

a)

30

b)

22

c)

32

d)

36

11.

Identify wrong C keyword below

a)

auto, double, int, struct

b)

break, else, long, switch

c)

case, enum, register, typedef

d)

char, extern, intern, return

12.

Which of the following bitwise operators works best for turning a particular off in any given number?

a)

& operator

b)

&& operator

c)

! operator

d)

|| operator

13.

Each statement in a C program should end with?

a)

;

b)

:

c)

.(dot symbol)

d)

None of the above

14.

What is the 16-bit compiler allowable range for integer constants?

a)

-3.4e38 to 3.4e38

b)

-32767 to 32768

c)

-32668 to 32667

d)

-32768 to 32767

15.

The size of char is 1 byte when the char is:

a)

Signed

b)

Unsigned

c)

Both

d)

None

16.

The range and size of a data type range between various:

a)

Compilers

b)

Operating Systems

c)

Both

d)

None

17.

For which type, the format specifier "%i" is used?

a)

int

b)

char

c)

float

d)

double

18.

Which is correct with respect to the size of the data types in C?

a)

char > int > float

b)

char < int < float

c)

int < char < float

d)

int < chat > float

19.

Which of the following typecasting is accepted by C?

a)

Widening conversions

b)

Narrowing conversions

c)

Widening & Narrowing conversions

d)

None of the mentioned

20.

Which type of conversion is NOT accepted?

a)

From char to int

b)

From float to char pointer

c)

From negative int to char

d)

From double to char

21.

Decision making in the C programming language is

(a)  

22.

What will be the output of the following C code? int main(){ printf((43 > 43) ? "value 1 is greater!" : "value 1 is not greater!");}

a)

value 1 is greater!

b)

value 1 is not greater!

23.

What will be the result of - (! (25 > 25))

(a)  

24.

C language was invented in which laboratories?

(a)  

25.

What is an Identifier in C Language.?

4 lines
26.

An Identifier can start with?

(a)  

27.

A Variable of a particular type can hold only a constant of the same type

(a)  

28.

Number of Keywords present in C Language are

(a)  

29.

Each statement in a C program should end with

(a)  

30.

Types of Real numbers in C are

(a)  

31.

Sizes of short, int and long in a Turbo C C++ compiler in bytes are

(a)  

32.

In an integer, left most bit 0 in Signed representation indicates

(a)  

33.

Default storage class of a variable is

(a)  

34.

Evaluate int a = 12 + 3 * 5 / 4 -10

(a)  

35.

Evaluate int a=10+ 4.867

(a)  

36.

Out of the following, which one is not valid as an if-else statement?

a)

if ((char) x){}

b)

if (x){}

c)

if (func1 (x)){}}

d)

if (if (x == 1)){}

37.

We cannot use the keyword 'break' simply within _________.

a)

while

b)

for

c)

if-else

d)

do-while

38.

In C, what is the purpose of the 'goto' statement?

a)

Break out of a loop

b)

Terminate the program

c)

Transfer control to a labeled statement

d)

Execute a function

39.

Which loop is faster in C Language, for, while or Do While

a)

for

b)

while

c)

do-while

d)

All work same speed

40.

What is the output of C Program void main(){ int a=5; while(a=12){ printf("RCEE"); break; }

4 lines
41.

ster in C Language, for, while or Do While

a)

A. for

b)

B. while

c)

C. do-while

d)

D. All work same speed

42.

What is the output of C Program void main(){ int a=5; while(a=12){ printf("RCEE"); break; } printf("Eluru");}

a)

A. RCEE

b)

B. Eluru

c)

C. RCEEEluru

d)

D. Compile error

43.

How many times RCEE is printed? main(){ while(1){ printf("RCEE"); } }

a)

A. One time

b)

B. Infinite Times

c)

C. Compile error

d)

D. Runtime error

44.

How many times the following code prints the string "hello" for(i=1;i<=50;i++) printf("Hello");

a)

A. 1

b)

B. 50

c)

C. 0

d)

D. None of them

45.

A labeled statement consist of an identifier followed by

a)

A. ;

b)

B. :

c)

C. ,

d)

D. =

46.

How many loops are there in C

a)

A.2

b)

B. 3

c)

C. 4

d)

D. 1

47.

What will be the output of the following piece of code? #include int main() { int value = 0; if(value) printf("CSE"); printf("RCEE"); return 0; }

a)

A. CSERCEE

b)

B. RCEE

c)

C. complier error

d)

D. None of these

48.

Choose facts about continue; statement is C Language

a)

A. continue; is used to take the execution control to next iteration or sequence

b)

B. continue; statement causes the statements below it to skip for execution

c)

C. continue; is usually accompanied by IF statement.

d)

D. All the above.

49.

Choose a correct statement about C break; statement.

a)

A. break; statement can be used inside switch block

b)

B. break; statement can be used with loops like for, while and do while.

c)

C. break; statement causes only the same or inner loop where break; is present to quit suddenly.

d)

D. All the above.

50.

Choose a correct statement about C language break; statement

a)

A. A single break; statement can force execution control to come out of only one loop.

b)

B. A single break; statement can force execution control to come out of a maximum of two nested loops.

c)

C. A single break; statement can force execution control to come out of a maximum of three nested loops.

d)

D. None of the above.

51.

Choose a correct C Statement regarding for loop. for(; ;)

a)

A. for loop works exactly first time

b)

B. for loop works infinite number of times

c)

C. Compiler error

d)

D. None of the above.

52.

Expand or Abbreviate ASCII with regard to C Language

a)

A. Australian Standard Code for Information Interchange

b)

B. American Standard Code for Information Interchange

c)

C. American Symbolic Code for Information Interchange

d)

D. Australian Symbolic Code for Information Interchange

53.

What is the output of C Program with switch statement or block int main(){ int a=3; switch(a){ } printf("RCEE");}

a)

A. RCEE

b)

B. No Output

c)

C. Compile Error

d)

D. Runtime Error

54.

What is the output of C Program with switch statement or block int main(){ int a; switch(a){ printf("APACHE "); } printf("HEROHONDA");}

a)

A. APACHE HEROHONDA

b)

B. HEROHONDA

c)

C. No Output

d)

D. Compiler error

55.

Which of the following statement about for loop is true?

a)

A. Index value is retained outside the loop

b)

B. Index value can be changed from within the loop

c)

C. Goto can be used to jump, out of the loop

d)

D. All of these

56.

What will be the output if you will compile and execute the following C code void main(){ if(printf("RCEE")) printf("Eluru"); else printf("WG");}

a)

A. Eluru

b)

B. WG

c)

C. RCEEEluru

d)

D. Compiler Error

57.

Which of the following is true

a)

A. The body of a while loop is executed at least once

b)

B. The body of a do-while loop is executed at least once

c)

C. The body of a do-while loop is executed zero or more times

d)

D. A for loop can never be used in place of a while loop

58.

The if statement is a conditional statement? (True/False)

(a)  

59.

When the condition of if statement is false, the flow of code will (a)  

60.

Can the else statement exist without the if statement in C?

(a)  

61.

The if-else if-else statement in C programming is used?

(a)  

62.

How many expressions can be checked using if...elseif...else statement?

(a)  

63.

Multiple values of the same variable can be tested using (a)   .

64.

When all cases are unmatched which case is matched in a switch statement?

(a)  

65.

Loops in C programming are used to (a)   .

66.

What will happen if the loop condition will never become false?

(a)  

67.

When all parts of the for loop are eliminated, what will happen?

(a)  

68.

Can a loop be nested in C programming?

(a)  

69.

Which loop executes the block a specific number of times?

(a)  

70.

If block always need to be associated with an else block?

(a)  

71.

The conditional operator are also known as

4 lines
72.

If you have to make decision based on multiple choices, the best suited loop is

(a)  

73.

The continue statement cannot be used with (a)  

74.

What will be the value of y if x = 8? y=(x>6 ? 4 : 6) ans:

(a)  

75.

Name the operator reverses the result of expression it operators on

4 lines
76.

goto can be used to jump from main to within a function?

(a)  

77.

Switch statement does not accept which values to its case labels

(a)  

78.

Which loop is guaranteed to execute at least one time

(a)  

79.

A labeled statement consists of an identifier followed by

(a)  

80.

do-while loop terminates when conditional expression returns?

(a)  

81.

For loop in a C program, if the condition is missing?

4 lines
82.

How long the following loop runs? for( i=1; i=3;i++)

4 lines
83.

In ___loop fusion____, the bodies of the two loops are merged together to form a single loop provided that they do not make any references to each other.

(a)  

84.

A switch statement is used to To choose from multiple possibilities based on a variable

(a)  

85.

If switch is present then default label must be presented

(a)  

86.

Given b = 110 and c = 20, what is the value of 'a' after execution of the expression a = b = c*=5?

(a)  

87.

What is the use of the size() operator?

4 lines