wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

C Programming Quiz

Total questions: 110

Worksheet time: 2hrs 50mins

Name
Class
Date
1.

Developer of ‘C’ language is ______________.

a)

Dennis Richie

b)

Ken Thompson

c)

Bill Gates

d)

Peter Norton

2.

C language developed in _________________.

a)

1970

b)

1972

c)

1976

d)

1980

3.

C is ______ level language.

a)

High

b)

Low

c)

Middle

d)

Machine

4.

C is available for which OS?

a)

DOS

b)

Windows

c)

Unix

d)

All of above

5.

Which symbol is used for pre-processor statement?

a)

!

b)

#

c)

~

d)

;

6.

Which of the following is a scalar data type?

a)

Float

b)

Union

c)

Array

d)

Pointer

7.

Which of the following are tokens in C?

a)

Keywords

b)

Variables

c)

Constants

d)

All of above

8.

Which is the valid range of “int” data type?

a)

0 to 256

b)

-32768 to +32767

c)

-32767 to +32768

d)

No particular range

9.

Which symbol is used to terminate a statement?

a)

!

b)

#

c)

~

d)

;

10.

Which escape sequence character is a line terminator?

a)

\a

b)

\b

c)

\m

d)

\n

11.

Which escape sequence character is used to beep from speaker?

a)

\a

b)

\b

c)

\m

d)

\n

12.

Character constants should be enclosed between ____________.

a)

Single Quotes

b)

Double Quotes

c)

Both A and B

d)

None of these

13.

String constants should be enclosed between ____________.

a)

Single Quotes

b)

Double Quotes

c)

Both A and B

d)

None of these

14.

Which of the following is invalid?

a)

‘ ’

b)

“ ”

c)

‘a’

d)

‘abc’

15.

The maximum length of a variable in C is ______________.

a)

8

b)

16

c)

32

d)

64

16.

The maximum size of ‘float’ variable is ________________.

a)

1 byte

b)

2 bytes

c)

4 bytes

d)

8 bytes

17.

The maximum size of ‘double’ variable is _______________.

a)

1 byte

b)

2 bytes

c)

4 bytes

d)

8 bytes

18.

A declaration of float a; double b; occupies ________ of memory.

a)

1 byte

b)

6 bytes

c)

10 bytes

d)

12 bytes

19.

The size of a string variable is __________.

a)

1 byte

b)

10 bytes

c)

20 bytes

d)

Not specific

20.

Which is an example of compounded assignment statement?

a)

a=5

b)

a=b

c)

a=b=c

d)

a+=10

21.

The operator && is used for ________.

a)

Value assignment

b)

Increment by 1

c)

Logical comparison

d)

Condition Checking

22.

The operator & is used for _________.

a)

Bitwise AND

b)

Logical AND

c)

Pointer to the variable

d)

None of these

23.

The equality operator is represented by _________.

a)

:=

b)

.EQ

c)

=

d)

==

24.

Operator’s precedence determines which operator is ____________.

a)

Faster

b)

Take no argument

c)

Take less memory

d)

Evaluated first

25.

The bitwise AND is used for _______________.

a)

Masking

b)

Comparison

c)

Division

d)

Shifting bits

26.

The operator << is used for ________________.

a)

Shifting bits to left

b)

Equality Checking

c)

Shifting bits to right

d)

None of these

27.

Which of the following has the HIGHEST precedence?

a)

*

b)

==

c)

=>

d)

+

28.

The associability of = operator is ________.

a)

Right to Left

b)

Left to Right

c)

None of these

d)

All of above

29.

Which operator has LOWEST priority?

a)

++

b)

%

c)

||

d)

()

30.

Which operator has HIGHEST priority?

a)

()

b)

||

c)

%

d)

++

31.

Integer Division results in ___________.

a)

Truncating the fractional part

b)

Rounding the fractional part

c)

Floating value

d)

An error is generated

32.

Which is a Ternary Operator?

a)

? :

b)

*

c)

sizeof

d)

^

33.

The typecast operator is ____________.

a)

cast ()

b)

(data type)

c)

//

d)

“ ”

34.

Explicit type conversion is known as ___________.

a)

Separation

b)

Conversion

c)

Casting

d)

Disjunction

35.

a+=4 means ____________.

a)

a=a+4

b)

a=4

c)

a+4=a

d)

a=4+4

36.

p++ executes faster than p=p+1 because ______________________.

a)

p uses registers

b)

++ is faster than +

c)

p++ is a single instruction

d)

All of above

37.

Which statement is correct?

a)

C Library functions provide I/O facilities

b)

C inherent I/O facilities

c)

C doesn’t have I/O facilities

d)

Both (a) and (c)

38.

Header files in C contain ___________.

a)

Compiler Commands

b)

Header information of C Programs

c)

Library functions

d)

Operators for files

39.

Which pair is used for single character I/O.?

a)

getchar() and putchar()

b)

scanf() and printf()

c)

input() and output()

d)

None of these

40.

The printf() returns __________ value when an error occurs.

a)

Positive value

b)

Zero

c)

Negative Value

d)

None of these

41.

Identify wrong statement:

a)

putchar(65)

b)

putchar(“x”)

c)

putchar(‘x’)

d)

putchar(‘\n’)

42.

An Ampersand in scanf() before the name of a variable denotes ___________.

a)

Actual Value

b)

Variable Name

c)

Address

d)

Data Type

43.

Symbolic constants can be defined using _____________.

a)

#define

b)

symbols

c)

const

d)

None of these

44.

Null character is represented by _____________.

a)

\n

b)

\0

c)

\o

d)

\e

45.

Which header file is essential for using strcmp() function?

4 lines
46.

Null character is represented by _____________.

a)

\n

b)

\0

c)

\o

d)

\e

47.

Which header file is essential for using strcmp() function.?

a)

string.h

b)

strings.h

c)

text.h

d)

strcmp.h

48.

malloc() used in Dynamic Memory Allocation is available in ____________.

a)

stream.h

b)

malloc.h

c)

alloc.h

d)

stdio.h

49.

Testing & Conversion character functions in C are available in ____________.

a)

ctype.h

b)

string.h

c)

math.h

d)

conio.h

50.

C supports ________ Looping statements.

a)

5

b)

3

c)

6

d)

8

51.

A statement differs from an expression by terminating with a _________.

a)

Semicolon (;)

b)

Colon (:)

c)

NULL

d)

dot (.)

52.

Which of the following is an unconditional control structure?

a)

Do-while

b)

if-else

c)

goto

d)

for

53.

Which of the following is a keyword is used for a storage class.?

a)

printf

b)

external

c)

auto

d)

scanf

54.

In C language ‘a’ represents ______________________.

a)

a digit

b)

an integer

c)

a character

d)

a word

55.

The number of Arithmetic operators in C language is ____________.

a)

4

b)

5

c)

6

d)

7

56.

How many keywords are available in ‘C’?

a)

32

b)

34

c)

36

d)

30

57.

Advantage of UNION over STRUCTURE is _______________.

a)

Memory Storage

b)

Memory Location

c)

Memory Screen

d)

None of these

58.

Maximum number of elements in the array declaration “ int arr[5][8]; ” is ________.

a)

28

b)

32

c)

35

d)

40

59.

Array subscripts in C always start at __________.

a)

1

b)

-1

c)

as per programmer

d)

0

60.

Which is the correct way to declare a pointer?

a)

int ptr;

b)

*int *ptr;

c)

int *ptr;

d)

*int ptr;

61.

Output of the printf(“2.3f\n”,17.23478) will be _____________.

a)

17.23478

b)

17.235

c)

17.2348

d)

17.23

62.

What will be the value of the following: 1. floor(5.8) 2. floor(-5.8)

a)

-5,-6

b)

5, -6

c)

5,6

d)

-5,6

63.

What would be the value of X after execution of the following statements? int x,y=10; char z=’a’; x=y+z;

a)

Invalid

b)

17

c)

10a

d)

107

64.

What will be the output the following: #include #include void main() { int *i, *j, a=12, b=2, c ; c= (a=a+b, b=a/b, a=a*b, b=a-b); i= &c; printf (“%d”,--(*i)); }

a)

93

b)

92

c)

91

d)

90

65.

Study the following program: #include #include void main() { int a=7,b=5; switch(a/a%b) { case 1: a=a-b; case 2: a=a+b; case 3: a=a*b; case 4: a=a/b; default: a=a; } printf(“%d”, a); }

a)

7

b)

5

c)

2

d)

None of above

66.

A ________ operator applies to two operands, while a _______ operator applies to a single operand.

a)

Binary, Unary

b)

Ternary, Binary

c)

Unary, Ternary

d)

None of these

67.

A ________ is a place where we can store values. Size of INT is ____________ bits.

a)

int, 2

b)

variable, 2

c)

int, 16

d)

variable, 16

68.

Variable consist of letters, numbers and _________________. You can’t use ___________.

a)

Underscore, keyword

b)

Identifier, keyword

c)

Alphabets, underscore

d)

Underscore, identifier

69.

Study it: #include #include void main() { int count=1,digit=0; while(digit<=9) { ++count; ++digit; } printf(“%d”,count); } What will be the output?

a)

10

b)

9

c)

11

d)

12

70.

What will be the output of following program? #include #include void main() { int i, j, k; j=5; i= 2*j/2; k=2*(j/2); printf(“i=%d \n k=%d”, i, k); }

a)

i=5, k=5

b)

i=4, k=4

c)

i=5, k=4

d)

i=4, k=5

71.

Study the following program: #include #include void main() { int a, b, c; a=2; b=2*(a++); c=2*(++a); printf(“b=%d \n c=%d”,b,c); }

a)

b=4,c=6

b)

b=3, c=6

c)

b=3,c=8

d)

b=4, c=8

72.

Study the following program: #include #include void main() { int *ptr, i; i=12; *ptr=i * i; ++i; printf(“%d %d”, i, *ptr); }

a)

12, 144

b)

13, 144

c)

13, 0

d)

None of these

73.

Study the following program: #include #include void main() { int a=3; switch(a) { case 1: printf(“One”); case 3: printf(“Three”); case 5: printf(“Five”); case 7: printf(“Seven”); default: printf(“Odd”); break; } What will be the output of above program?

a)

Three

b)

Three Five Odd

c)

Three Five Seven Odd

d)

Three Five Seven

74.

Study the following program: #include #include union example { int i; float f; double d; }; void main() { union example e; printf(“\n Size of union is: %d”, size of(e)); }

a)

8

b)

6

c)

10

d)

14

75.

Study the following program: #include #include void main() { int i=0, X=0; do { if(i%5==0) { X++; } ++i; } while (i <20); } What will be the output of this program?

a)

X=4

b)

X=20

c)

X=25

d)

X=10

76.

What will be the output of this program? int i=0, X=0; while (i<20) { if(i%5==0) { X+=i; } i++; } printf(“X=%d”, X);

a)

X=30

b)

X=20

c)

X=25

d)

X=10

77.

What will be the output of above program? int i, n=2; for(i=0; i<2; i++) { if(!(i<=n) && (++n==i)) n=n+2; else n=n-2; }

a)

3

b)

4

c)

2

d)

None of these

78.

Symbol of Magnetic Tape is

4 lines
79.

Which is not a symbol of Flow-Chart.?

4 lines
80.

Pre-programming technique is.??

a)

Flow Chart

b)

Algorithm

c)

Dry Run

d)

All of Above

81.

Which is the step by step representation of program creation?

a)

Algorithm

b)

Dry Run

c)

None of Above

82.

Dry Run is a __________.

a)

Tabular Development

b)

Step by Step Development

c)

Graphical Representation

d)

None of Above

83.

‘B’ language is developed by___________.

a)

Martin Richards

b)

Dennis Ritchie

c)

Ken Thompson

d)

Berian Kerningham

84.

Which of the following symbol is use for single line comment?

a)

//

b)

\\

c)

/* ...... */

d)

;

85.

Which is not the graphical representation of program creation?

a)

Algorithm

b)

Flow Chart

c)

Dry Run

d)

(A) and (B) both

86.

ANSI C permits the use of as many as ________ case labels.

a)

258

b)

259

c)

257

d)

256

87.

Structure template is terminated by symbol _____________.

a)

Semicolon ( ; )

b)

Comma ( , )

c)

Space ( )

d)

Underscore ( _ )

88.

? : is ______________ operator.

a)

Logical

b)

Bitwise

c)

Assignment

d)

Conditional

89.

Which symbols used to define an array?

a)

[ ]

b)

{ }

c)

< >

d)

( )

90.

Find the error: void main() { int a=11 ; if(a>0); printf(“Its POSITIVE”); else printf(“Its NEGATIVE”); }

a)

getch(); is missing

b)

misplaced else

c)

statement missing

d)

None of above

91.

Which is a relational operator?

a)

&&

b)

>=

c)

? :

d)

/* ...... */

92.

To check whether string is in upper case or not, which function is used?

a)

toupper ()

b)

upper ()

c)

isupper()

d)

None of above

93.

pow(), abs() & sqrt() are situated in ______________ header file.

a)

stdio.h, math.h, ctype.h

b)

ctype.h

c)

string.h

d)

math.h

94.

Which is not the part of UDF?

a)

Prototype of Function

b)

Definition of Function

c)

Calling of Function

d)

None of above

95.

How compare that two strings are equal or not?

a)

strcmp()

b)

strcat()

c)

strrev()

d)

strchr()

96.

Which is a storage class?

a)

auto

b)

static

c)

register

d)

All of above

97.

64 bits occupied by which data type?

a)

double

b)

long double

c)

unsigned int

d)

int

98.

Which special symbol is allowed for variable declaration ____________?

a)

Under Score ( _ )

b)

Caret ( ^ )

c)

Tiled ( ~ )

d)

Colon ( : )

99.

< , > are used for __________________.

a)

Function Call

b)

Array

c)

Link to Header file

d)

Function Definition

100.

Percentage style of “unsigned int” is ____________.

a)

%ld

b)

%c

c)

%u

d)

%lu

101.

______________as an alternative of simple if...else statement.

a)

Conditional Operator

b)

? : Operator

c)

Ternary Operator

d)

All of above

102.

Which is not an Entry Control.?

a)

for loop

b)

do...while loop

c)

while loop

d)

All of above

103.

How many types of operators are there?

a)

7

b)

9

c)

10

d)

8

104.

What is the output of below program? int a=11,b ; b=a++ printf(“\n\t B: %d”, b);

a)

Error

b)

12

c)

11

d)

None of above

105.

a -=b is equivalent to ________________.

a)

a=b-a

b)

b=b-a

c)

a=a-b

d)

b=a-b

106.

{ } are used to group statements together as in a function, or in the body of a loop. Such a grouping is known as _________________.

a)

Statement

b)

Block

c)

Loop

d)

Process

107.

Which is the Escape Sequence character?

a)

\n

b)

\a

c)

\o

d)

(A) and (B) both

108.

Null character is represented by ___________.

a)

NULL

b)

\0

c)

\o

d)

All of above

109.

_________ Symbol behaves as STYLE while using with one variable and as REMINDER while using with two variable/values.

a)

&

b)

%

c)

*

d)

#

110.

_____ and _____ are used to test more than one condition.

a)

&&, ||

b)

<=, >=

c)

==, !=

d)

<, >