Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Basics of C

Total questions: 30

Worksheet time: 15mins

Name
Class
Date
1.

What is an algorithm?

a)
A recipe for cooking a meal.
b)
A random guess without any steps.
c)
A collection of data points without instructions.
d)
An algorithm is a step-by-step procedure for solving a problem.
2.

Which symbol is commonly used to represent a decision in a flowchart?

a)
Circle
b)
Triangle
c)
Square
d)
Diamond
3.

Which of the following is a characteristic of structured programming?

a)
Use of control structures like sequences, selections, and iterations.
b)
Use of random number generation for control flow.
c)
Emphasis on unstructured code and goto statements.
d)
Focus on object-oriented programming principles.
4.

What is a pseudo code?

a)
A pseudo code is a graphical representation of data flow.
b)
A pseudo code is a type of computer virus.
c)
A pseudo code is a simplified, human-readable representation of an algorithm.
d)
A pseudo code is a programming language used for software development.
5.

In a flowchart, the start/end is shown using:

a)
Oval or rounded rectangle
b)
Rectangle
c)
Diamond
d)
Square
6.

Structured programming promotes:

a)

Jumping with goto

b)

Breaking problems into modules

c)

Writing unstructured code

d)

All of the above

7.

Which of the following is NOT a valid algorithm feature?

a)
Correctness
b)
Randomness
c)
Efficiency
d)
Determinism
8.

Which of the following is a valid variable in C?

a)
var1
b)
var-1
c)
1var
d)
var@1
9.

What is the size of int in most systems (32-bit)?

a)
16 bytes
b)
8 bytes
c)
2 bytes
d)
4 bytes
10.

Which keyword is used to declare a constant in C?

a)
static
b)
const
c)
final
d)

constant

11.

The %d format specifier is used for:

a)

Character input

b)

Float input

c)

Integer input

d)

String input

12.

Which operator is used for division in C?

a)
/
b)
-
c)
%
d)
*
13.

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

a)
integer
b)
float
c)
string
d)
char
14.

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

a)
11
b)
8
c)
16
d)
10
15.

What is the correct way to take integer input in C?

a)

scanf("%f", &a);

b)
scanf("%d", &variable);
c)
read_integer(&variable);
d)
printf("%d", variable);
16.

Which statement is used to make a decision in C?

a)
if
b)
while
c)
for
d)
switch
17.

Which loop is executed at least once even if the condition is false?

a)
foreach loop
b)
while loop
c)
for loop
d)
do-while loop
18.

What is the output of this code?

int x = 5;

if (x == 5)

printf("Yes");

else

printf("No");

a)
Yes
b)

Error

c)

5

d)
No
19.

Which control statement is used to exit from a loop?

a)
continue
b)
return
c)
break
d)
skip
20.

The switch statement can be used with in C:

a)

int

b)

char

c)

both (int, char)

d)

string

21.

The syntax of a `for` loop is in C:

a)
for(condition; initialization; increment/decrement) { // code to execute }
b)
for(initialization; condition; increment/decrement) { // code to execute }
c)
for(initialization; increment/decrement; condition) { // code to execute }
d)
for(initialization; condition) { // code to execute }
22.

Which loop is best when the number of iterations is known?

a)
for loop
b)
foreach loop
c)
do-while loop
d)
while loop
23.

A function in C must be

a)

define

b)

declare

c)

called

d)

all of these

24.

What is recursion?

a)
Recursion is a technique for optimizing code performance.
b)
Recursion is a method of data storage in programming.
c)
Recursion is a way to iterate through a list of items.
d)
Recursion is a method where a function solves a problem by calling itself.
25.

Which keyword is used to define a function?

a)
function
b)

define

c)

void/int/char

d)
method
26.

What is the default return type of a C function if not specified?

a)
void
b)
float
c)
int
d)
char
27.

Call by value means:

a)

Passing address of variable

b)

Passing copy of value

c)

Passing pointers

d)

Using global variables

28.

Call by reference can be done using:

a)

Arrays

b)

functions

c)

Pointers

d)

Loops

29.

Which function is used to return a value in C?

a)
return
b)
print
c)
display
d)
output
30.

Scope rules define:

a)

Data types of variables

b)

Where a variable is accessible

c)

Return type of functions

d)

Size of the program