wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CIT-114 Introduction to computer Programming

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

Which language is known for its ability to handle complex tasks with minimal code?

a)

Assembly

b)

Python

c)

C

d)

JavaScript

2.

Which is the correct syntax to include a header file in a C++ program?

a)

#include<iostream>

b)

#include "iostream"

c)

#include iostream

d)

Both A and B

3.

What does the grammar syntax of programming languages ensure?

a)

Vague interpretation

b)

Flexibility

c)

Correct interpretation of instruction

d)

Non-standard instructions

4.

What type of instructions can be written to a machine compared to a human?

a)

Vague and context dependent

b)

Precise and step by step

c)

Flexible and general

d)

Implied and interpretive

5.

What is the purpose of using curly braces {} in an if-else statement?

a)

To declare variables

b)

To group multiple statements

c)

To initialize an array

d)

To create a function

6.

Which of the following is the correct declaration of a float variable?

a)

float num;

b)

int num;

c)

double num;

d)

decimal num;

7.

Which of the following is the correct way to read an integer from the keyboard in C++?

a)

cin >> integerVariable;

b)

cin.read(integerVariable);

c)

read >> integerVariable;

d)

input integerVariable;

8.

Which of the following keywords is used to define a function in C++?

a)

function

b)

method

c)

def

d)

void

9.

What is the output of the following code snippet: cout << 5 + 3 * 2;?

a)

16

b)

11

c)

8

d)

10

10.

What will be the output of the following code snippet: cout << 10 / 2 + 3;?

a)

7

b)

8

c)

5

d)

6

11.

What will be the output of the following code snippet: cout << 15 % 4 + 2;?

a)

3

b)

7

c)

6

d)

5

12.

What is the output of the following code snippet: cout << (3 + 2) * 2;?

a)

6

b)

5

c)

10

d)

8

13.

What is the primary difference between signed and unsigned data types?

a)

Signed type can hold only positive values.

b)

Unsigned type can hold both positive and negative values.

c)

Unsigned type can only hold positive values.

d)

There is no difference; they are the same.

14.

What is the purpose of the assignment operator = in C++?

a)

To compare two values

b)

To perform an arithmetic operation

c)

To assign a value to a variable

d)

To declare a variable

15.

How do parentheses affect expressions in C++?

a)

They have no effect

b)

They always cause an error

c)

They determine the order of operations

d)

They only affect arithmetic operations

16.

Which of the following is a valid way to declare a constant in C++?

a)

#define x 10

b)

let x = 10;

c)

const int x = 10;

d)

constant int x = 10;

17.

What is the purpose of the switch statement in C++?

a)

To compare two values

b)

To execute a block of code among multiple options based on a variable's value

c)

To create a loop

d)

To handle exceptions

18.

Which of the following is a correct syntax for an if statement in C++?

a)

if(Condition){statement;}

b)

if(Condition) statement;

c)

if Condition {statement;}

d)

Both A and B

19.

What does the for loop do in C++?

a)

Repeats a block of code a specified number of times

b)

Checks a condition and executes code if it's true

c)

Defines a function

d)

None of the above

20.

Why do computers require exact instructions?

a)

To enhance flexibility

b)

To ensure precision and correctness

c)

To allow ambiguity

d)

To simplify hardware design

21.

Which of the following is used to create a loop that executes at least once in C++?

a)

while loop

b)

for loop

c)

foreach loop

d)

do-while loop

22.

What is the purpose of the break statement in C++?

a)

To exit a loop or switch statement

b)

To pause the execution

c)

To skip the current iteration

d)

To terminate the program

23.

what is your computer classified as in term of computing?

a)

Specific purpose device

b)

General purpose computing device

c)

Static device

d)

Non computational device

24.

Which device requires exact setting such as timer and water level for operation?

a)

Human

b)

Microwave

c)

Washing machine

d)

Calculator

25.

What happens if the user enters a non integer value when reading an integer in C++

a)

The program will terminate

b)

To value will be stored as zero

c)

It will cause an infinite loop

d)

The input will fail and the variable remains unchanged