wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C Programming - Quiz

Total questions: 20

Worksheet time: 7mins

Name
Class
Date
1.

Who invented C Language.?

a)

Charles Babbage

b)

Grahambel

c)

Dennis Ritchie

d)

Steve Jobs

2.

Correct way of commenting a single line is.?

a)

/*printf("Hello C..");

b)

//printf("Hello C..");

c)

/*printf("Hello C..");*/

d)

/printf("Hello C..");/

3.

What is output of below program?


int main()

{

int i;

for(i=0; i<5; ++i++)

{

printf("Hello");

}

return 0;

}

a)

Hello is printed 5 times

b)

Compilation Error

c)

Hello is printed 2 times

d)

Hello is printed 3 times

4.

Find an integer constant.

a)

3.145

b)

34

c)

"125"

d)

None of the above

5.

Number of Keywords present in C Language are .?

a)

32

b)

34

c)

62

d)

64

6.

Each statement in a C program should end with.?

a)

Semicolon ;

b)

Colon :

c)

Period . (dot symbol)

d)

None of the above.

7.

_______________to be included to use standard I/O functions : prinf(),scanf()

a)

#include<conio.h>

b)

#include<stdio.h>

c)

#include<string.h>

d)

#include<math.h>

8.

________to be included to use mathematical functions sqrt()

a)

#include<conio.h>

b)

#include<string.h>

c)

#include<math.h>

d)

#include<stdio.h>

9.

Which is correct example for variable declaration?

a)

int a;b;c;

b)

Int a,b,c;

c)

int a,b,c;

d)

int a,b;c;

10.

Every variable must be -------------- before it is used.

a)

executed

b)

defined

c)

declared

d)

identified

11.

Which of the following is not logical operator?

a)

&

b)

&&

c)

||

d)

!

12.

Which of the following is the correct operator to compare two variables?

a)

equal

b)

=

c)

:=

d)

==

13.

The "\n" character does which of the following operations?

a)

Double line spacing

b)

Character deletion

c)

Character backspace

d)

Places cursor on the next line

14.

if two strings are identical then function strcmp() returns

a)

0

b)

-1

c)

true

d)

none of these

15.

str1="6/4";

printf("str1");

a)

6/4

b)

str1

c)

None

16.

What will the output of the following program?

#include <stdio.h>

int main()

{

char str1[] = "College";

char str2[] = "University";

strcpy(str1, str2);

printf("%s", str1);

}

a)

College

b)

University

c)

College University

d)

University College

17.

What is right way to Initialize array?

a)

int num[6] = { 2, 4, 12, 5, 45, 5 };

b)

int n{} = { 2, 4, 12, 5, 45, 5 };

c)

int n{6} = { 2, 4, 12 };

d)

int n(6) = { 2, 4, 12, 5, 45, 5 };

18.

Which is not a built in function

a)

string()

b)

strlen()

c)

strcat()

d)

strcmp()

19.

String is initialized with datatype

a)

float

b)

char

c)

int

d)

double

20.
Which string method helps find length of string?
a)
stringLength()
b)
strlen
c)
strdup
d)
both i & ii