wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Which operator is used to find the remainder of a division?

a)

/

b)

*

c)

%

d)

==

2.

In the statement scanf("%d", &age);, what is the purpose of the & symbol?

a)

It signifies the end of the program.

b)

It indicates the memory address of the age variable.

c)

It converts the number into text.

d)

It's a special character for printing.

3.

Given the code int x = 10; printf("%d", ++x);, what is the output?

a)

10

b)

11

c)

12

d)

9

4.

What happens when you use the post-increment operator, like x++?

a)

The value of x is increased by 1 first, and then its new value is used.

b)

B) The program adds 2 to x.

c)

The current value of x is used first, and then it is increased by 1.

d)

It causes a syntax error.

5.

What is the primary function of an if statement?

a)

To run a block of code repeatedly.

b)

To stop the program.

c)

To define a new variable.

d)

To execute code only if a specific condition is true.

6.

How would you write the condition to check if an integer variable number is even?

a)

if (number / 2 == 0)

b)

if (number % 2 == 0)

c)

if (number * 2 == 0)

d)

if (number - 2 == 0)

7.

When does the code inside an else block run?

a)

It runs when the if condition is false.

b)

It runs when the if condition is true.

c)

It always runs after the if block.

d)

It only runs if there is an error.

8.

Which of these is a relational operator used for comparing values?

a)

+

b)

&&

c)

<=

d)

!

9.

In the code to check for a vowel, which logical operator is used to combine the conditions ch == 'a', ch == 'e', etc.?

a)

&& (AND)

b)

! (NOT)

c)

|| (OR)

d)

== (EQUAL)

10.

What is the value of score after this code runs: int score = 10; score++; score--;?

a)

9

b)

10

c)

11

d)

12