wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Fundamentals Quiz

Total questions: 28

Worksheet time: 14mins

Name
Class
Date
1.

What is the purpose of the Console.WriteLine() method?

a)

Reads only one single character from the standard input stream

b)

Reads a single line from the standard input stream

c)

Writes a specified string value to the standard output stream

d)

Returns an integer after reading a single character

2.

Which data type is used to store characters in C#?

a)

float

b)

char

c)

int

d)

double

3.

What is the result of 20 % 4 in C#?

a)

0

b)

2

c)

1

d)

4

4.

Which operator is used for multiplication in C#?

a)

/

b)

-

c)

*

d)

+

5.

If 1 + 1 = 2, and 2 + 2 = 4, what is 3 + 3

a)

6

b)

Fish

c)

A question for a mathematician, not me

6.

What is the purpose of the boolean data type in C#?

a)

To store characters

b)

To evaluate conditions as true or false

c)

To perform arithmetic operations

d)

To store floating-point numbers

7.

Which operator is used to calculate the remainder of a division operation in C#?

a)

/

b)

*

c)

%

d)

+

8.

What is the correct way to assign a value to a variable x after adding 1 to its current value?

a)

x -= 1;

b)

x = x - 1;

c)

x += 1;

d)

x = x + 1;

9.

Which type of comment in C# starts with /* and ends with */?

a)

Single-Line comment

b)

Multi-Line comment

c)

Documentation comment

d)

No comment

10.

What is the purpose of the Console.Read() method in C#?

a)

Reads a single line from the standard input stream

b)

Reads only one single character from the standard input stream

c)

Returns an integer after reading a single character

d)

Writes a specified string value to the standard output stream

11.

Which data type is used to store floating-point numbers with higher precision in C#?

a)

char

b)

double

c)

float

d)

int

12.

What is the purpose of the Console.ReadLine() method in C#?

a)

Reads a single line from the standard input stream

b)

Reads only one single character from the standard input stream

c)

Returns an integer after reading a single character

d)

Writes a specified string value to the standard output stream

13.

Which data type is used to store integers in C#?

a)

float

b)

char

c)

int

d)

double

14.

What is the purpose of the Console.ReadKey() method in C#?

a)

Reads a single line from the standard input stream

b)

Reads only one single character from the standard input stream

c)

Returns an integer after reading a single character

d)

Writes a specified string value to the standard output stream

15.

What is the correct way to declare a variable of type double in C#?

a)

double x = 10.5;

b)

int x = 10.5;

c)

float x = 10.5;

d)

char x = 10.5;

16.

Which keyword is used to define a constant value in C#?

a)

var

b)

final

c)

const

d)

static

17.

What is the best car brand?

a)

BMW

b)

Toyota

c)

Audi

d)

Mazda

e)

Mercedes

18.

What is the purpose of the 'break' statement in a switch-case block in C#?

a)

To exit the loop and continue with the next iteration

b)

To skip the current iteration and move to the next one

c)

To exit the switch-case block and continue with the code after it

d)

To restart the loop from the beginning

19.

What is the purpose of the 'continue' statement in a loop in C#?

a)

To exit the loop and continue with the next iteration

b)

To skip the current iteration and move to the next one

c)

To exit the loop and terminate the loop execution

d)

To restart the loop from the beginning

20.

What do you call a programmer who can't solve a bug?

a)

A debug-free zone

b)

A code-breaker

c)

A bug-eyed coder

21.

What is the purpose of the 'ToString()' method in C#?

a)

To convert an object to a string representation

b)

To convert a string to an object

c)

To compare two objects for equality

d)

To perform mathematical operations

22.

What is the correct syntax for a for loop in C#?

a)

for (int i = 0; i < 10; i++)

b)

for (int i = 0; i++)

c)

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

d)

for (i = 0; i++)

23.

Which statement is used to terminate the current iteration in a loop in C#?

a)

break;

b)

continue;

c)

return;

d)

exit;

24.

What is the purpose of the 'break' statement in a loop in C#?

a)

To skip the current iteration and move to the next one

b)

To exit the loop completely

c)

To restart the loop from the beginning

d)

To print a message to the console

25.

Which data type is used to store a single character in C#?

a)

char

b)

string

c)

int

d)

bool

26.

What is the purpose of the 'Console.Clear()' method in C#?

a)

Clears the console screen

b)

Writes a specified string value to the standard output stream

c)

Reads a single line from the standard input stream

d)

Reads only one single character from the standard input stream

27.

What do you call a lazy kangaroo?

a)

A pouch potato

b)

A sleepy joe

c)

A kangaroo with a Monday morning attitude

28.

What do you call a cheese that isn't yours?

a)

Nacho cheese

b)

Stolen brie

c)

A dairy dilemma