wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C-Volution (Easy 1)

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

Which of the following is the correct extension for a C program file?

a)

.js

b)

.c

c)

.java

d)

.py

2.

What is the correct syntax to print "Hello, World!" in C?

a)

print("Hello, World!");

b)

printf("Hello, World!");

c)

cout << "Hello, World!";

d)

System.out.println("Hello, World!");

3.

Which of the following is NOT a valid C variable name?

a)

my_var

b)

2nd_variable

c)

_count

d)

name123

4.

What symbol is used to end a statement in C?

a)

.

b)

,

c)

;

d)

:

5.

What is the keyword used to declare a function in C?

a)

def

b)

function

c)

void

d)

func

6.

Which function is used to read input from the user in C?

a)

scanf()

b)

input()

c)

get_input()

d)

read()

7.

What is the correct way to declare a constant in C?

a)

constant int x = 10;

b)

int x = const 10;

c)

#define x 10

d)

final int x = 10;

8.

Which keyword is used to return a value from a function?

a)

stop

b)

return

c)

end

d)

break

9.

What is the size of an int in C (usually)?

a)

2 bytes

b)

4 bytes

c)

8 bytes

d)

16 bytes

10.

What will be the output of printf("%d", 'A');?

a)

A

b)

65

c)

Error

d)

a

11.

Which of the following is NOT a valid data type in C?

a)

float

b)

double

c)

real

d)

char

12.

What is the result of 5 % 2 in C?

a)

2

b)

2.5

c)

1

d)

0

13.

What is the relational operator for "not equal to" in C?

a)

<>

b)

=!

c)

!=

d)

^=

14.

What will int x = 5; printf("%d", x++); print?

a)

5

b)

6

c)

Error

d)

4

15.

What is the logical AND operator in C?

a)

&

b)

&&

c)

|

d)

||

16.

How do you declare an array of size 5 in C?

a)

int arr[5];

b)

array int arr[5];

c)

arr[5] int;

d)

int[5] arr;

17.

Which loop will execute at least once in C?

a)

for

b)

while

c)

do-while

d)

None

18.

Which of the following is a pointer declaration?

a)

int *p;

b)

int p;

c)

int &p;

d)

pointer p;

19.

Which of the following statements about C is false?

a)

C is case-sensitive.

b)

C is an object-oriented language.

c)

C supports pointers.

d)

C is a structured language.

20.

Which library function is used to find the length of a string?

a)

len()

b)

strlen()

c)

strlength()

d)

size()

21.

What will printf("%c", 97); print?

a)

97

b)

'a'

c)

Error

d)

A

22.

How is a null character represented in C?

a)

'\n'

b)

'\0'

c)

'\t'

d)

' '

23.

Which function is used to allocate memory dynamically?

a)

malloc()

b)

alloc()

c)

memory()

d)

memalloc()

24.

What will be the output of printf("%d", sizeof(char));?

a)

1

b)

2

c)

4

d)

8

25.

What is the return type of the main() function in C?

a)

int

b)

void

c)

depends on the compiler

d)

None

26.

Which header file is required for printf()?

a)

stdlib.h

b)

stdio.h

c)

conio.h

d)

string.h

27.

What will be the output of printf("%d", 5 & 3);?

a)

1

b)

3

c)

5

d)

2

28.

What is the purpose of the break statement?

a)

Stop the program

b)

Exit from a loop

c)

Restart the program

d)

Ignore an error

29.

Which of the following is a comment in C?

a)

--

b)

//

c)

**

d)

%%

30.

What does return 0; indicate in the main() function?

a)

Program executed successfully

b)

Program has errors

c)

Loop terminated

d)

Memory fr