wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ClassQuiz1

Total questions: 25

Worksheet time: 12mins

Name
Class
Date
1.

What is a computer program?

a)

A set of instructions that a computer follows.

b)

A type of hardware.

c)

A programming language.

d)

A software application.

2.

What is the purpose of main() function in a C program?

a)

Defines the program's name.

b)

starting point of execution of the code.

c)

Prints output to the console.

d)

Declares variables.

3.

What is the purpose of a semicolon in C?

a)

To start a statement.

b)

To end a statement.

c)

To separate statements.

d)

To declare a variable.

4.

What is the output of printf("%d", 5 + 3);

a)

5 + 3

b)

8

c)

53

d)

Error

5.

What does return 0 typically indicate at the end of a `main` function?

a)

An error occurred.

b)

Successful program execution.

c)

The program should continue running.

d)

The program is incomplete.

6.

What does scanf("%d", &x); do?

a)

Prints the value of x.

b)

Reads an integer from the user and stores it in x.

c)

Declares a variable x.

d)

Calculates the value of x.

7.

Which of these is a logical AND operator?

a)

||

b)

&&

c)

!

d)

=

8.

Which operator is used for assigning a value to a variable?

a)

=

b)

==

c)

+

d)

-

9.

What does the `%d` format specifier do in `printf`?

a)

Prints a floating-point number.

b)

Prints a character.

c)

Prints an integer.

d)

Prints a string.

10.

What will the following code print: `printf("%d", 10 / 3);`?

a)

3.333...

b)

3

c)

0

d)

Error

11.

What is an algorithm?

a)

A programming language.

b)

A set of steps to solve a problem.

c)

A type of computer hardware.

d)

A software application.

12.

What is the purpose of a header file (e.g., stdio.h)?

a)

Stores the main program logic.

b)

Contains declarations of prebuilt functions.

c)

Stores the program's data.

d)

Contains the compiled code.

13.

Which of the following is a valid C identifier?

a)

1st_name

b)

my-variable

c)

_myVariable

d)

int

14.

What is the purpose of a keyword in C?

a)

To define user-defined functions.

b)

To declare variables.

c)

To reserve words with special meaning to the compiler.

d)

To name data types.

15.

What is a variable in C programming?

a)

A constant value.

b)

A named storage location.

c)

A function.

d)

A data type.

16.

Which format specifier is used to print a floating-point number in C?

a)

%c

b)

%d

c)

%f

d)

%s

17.

What is the purpose of the `&` operator in `scanf`?

a)

It represents the address of the variable.

b)

It performs addition.

c)

It performs bitwise AND operation.

d)

It is a modulo operator.

18.

What is the result of `printf("%f", 5.0/2.0);`?

a)

2

b)

2.5

c)

2.0

d)

2.500000

19.

Which operator is used for equality comparison in C?

a)

=

b)

==

c)

!=

d)

<=

20.

What does the ++ operator do?

a)

Decrements a value by 1

b)

Increments a value by 1

c)

Multiplies a value by 2

d)

Divides a value by 2

21.

What is a nested 'if-else' statement?

a)

An 'if' statement inside another 'if' statement.

b)

An 'else' statement inside an 'if' statement.

c)

Multiple 'if' statements in a row.

d)

An 'if' statement followed by an 'else if' statement.

22.

If a condition in an `if` statement evaluates to 0, it is considered:

a)

True

b)

False

c)

An error

d)

Undefined

23.

Which Loop Structure is shown in the flowchart?

a)

While

b)

do-while

c)

For loop

d)

none

24.

In a loop, it is mandatory either to increase or decrease the value loop control variable.

a)

True

b)

False

25.

Identify the correct option that should correctly fill the blanks.

a)

n and sum

b)

sum += n and sum

c)

sum -= n and n

d)

n += 1 and n