Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Introduction to Programming(C++) Quiz

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.

What is a program?

a)

The language used to write directions for a computer.

b)

The directions given to a computer to do a task.

c)

The people who write computer code.

d)

A diagram representing a process flow.

2.

Who are the people who write programs?

a)

Systems users

b)

Applications users

c)

Programmers

d)

System operators

3.

What is the primary function of a systems programmer?

a)

To customize programs for specific tasks.

b)

To write, maintain, and/or customize programs that handle a specific task.

c)

To write and maintain programs that help the computer carry out its basic operating functions.

d)

To create documents and spreadsheets.

4.

Which of the following is an example of a program written by an applications programmer?

a)

Microsoft Windows

b)

Linux Operating System

c)

Microsoft Word

d)

Machine language

5.

What is considered a low-level language?

a)

A language close to human language.

b)

A language that is easy to understand by humans.

c)

A language that is much closer to machine code.

d)

A language that is machine-independent.

6.

Which of the following is a characteristic of machine language?

a)

It is easy to write a program in.

b)

It is a user-friendly language.

c)

It does not require any language translator.

d)

It is difficult to debug.

7.

What is another name for Assembly language?

a)

High-level language

b)

Symbolic language

c)

Machine language

d)

Binary language

8.

What is required to convert assembly language instructions into machine code?

a)

Compiler

b)

Interpreter

c)

Assembler

d)

Linker

9.

Which of the following is a feature of high-level languages?

a)

They are machine-dependent.

b)

They are difficult for humans to understand.

c)

They are close to human language.

d)

They consist of zeroes and ones.

10.

What is the difference between a compiler and an interpreter?

a)

A compiler translates the program line by line, while an interpreter converts instructions into 0s and 1s.

b)

An interpreter converts the instructions into 0s and 1s, while a compiler translates the program line by line.

c)

Compilers convert instructions into 0s and 1s, and interpreters translate the program line by line as it is running.

d)

There is no difference; they are the same thing.

11.

What are the three basic control structures used in programming?

a)

Analyze, Plan, Desk-check

b)

Input, Processing, Output

c)

Sequence, Repetition, Selection

d)

Logic, Syntax, Debugging

12.

What does the repetition structure direct the computer to do?

a)

Process instructions in the order they are listed.

b)

Make a decision and take action based on that decision.

c)

Repeat one or more instructions until a condition is met.

d)

Transform input into output.

13.

The selection structure is also known as what?

a)

Loop

b)

Iteration

c)

Sequence

d)

Decision structure

14.

What is pseudocode?

a)

A diagram using shapes and arrows to represent process flow.

b)

A set of step-by-step instructions that can be understood by a computer.

c)

A planning tool using English-like statements to describe an algorithm.

d)

The final source code of a program.

15.

What is the purpose of a flowchart?

a)

To write the actual program code.

b)

To provide a step-by-step guide for humans.

c)

To serve as a planning tool that uses diagrams to represent the process-flow of a program.

d)

To compile a program.

16.

What is the first step in creating a computer solution to a problem?

a)

Planning the algorithm.

b)

Coding the algorithm.

c)

Analyzing the problem.

d)

Desk-checking the algorithm.

17.

What is the purpose of an IPO chart?

a)

To analyze a problem by organizing and summarizing the input, processing, and output.

b)

To write the actual program code.

c)

To draw a flowchart.

d)

To test the program with invalid data.

18.

What does "IPO" stand for in the context of problem-solving?

a)

Internal, Process, Operation

b)

Input, Program, Output

c)

Input, Processing, Output

d)

Instructions, Program, Operators

19.

An algorithm is defined as:

a)

A program written in a programming language.

b)

A diagram representing a process flow.

c)

A set of instructions that transforms a problem's input into its output.

d)

The process of finding errors in a program.

20.

Why is pseudocode also called "false code"?

a)

Because it uses symbols and arrows.

b)

Because it is written in English-like statements.

c)

Because it resembles programming language instructions but cannot be understood by a computer.

d)

Because it is always incorrect.

21.

What is the shape of a flowchart symbol that denotes a decision or branch?

a)

Parallelogram

b)

Rectangle

c)

Oval

d)

Diamond

22.

In a flowchart, what shape represents a process to be carried out, such as a calculation?

a)

Oval

b)

Rectangle

c)

Parallelogram

d)

Diamond

23.

What is the purpose of desk-checking an algorithm?

a)

To translate the algorithm into machine language.

b)

To follow each of the algorithm's instructions by hand using a pencil and paper.

c)

To fix syntax errors in the program.

d)

To evaluate and modify the program after it has been coded.

24.

A programmer testing an algorithm with data they do not expect the user to enter is using:

a)

Valid data

b)

Invalid data

c)

IPO data

d)

Random data

25.

What is the next step after analyzing a problem and planning the algorithm?

a)

Coding the algorithm into a program.

b)

Desk-checking the algorithm.

c)

Desk-checking the program.

d)

Evaluating and modifying the program.

26.

What is the purpose of internal memory in a computer?

a)

To display messages on the computer screen.

b)

To hold the program's source code.

c)

To store the values of input, processing, and output items as a program runs.

d)

To translate source code into machine code.

27.

A memory location whose value can change during runtime is called a(n):

a)

Keyword

b)

Constant

c)

Variable

d)

Identifier

28.

Which of the following is NOT a rule for naming a memory location in C++?

a)

The name must begin with a letter.

b)

The name can contain only letters, numbers, and the underscore character.

c)

The name cannot be a keyword.

d)

The name can contain a space.

29.

What is the correct syntax for declaring a named constant in C++?

a)

const constantName dataType = value;

b)

dataType constName = value;

c)

const dataType constantName = value;

d)

dataType const constantName = value;

30.

What C++ data type is used to store a real number with 15 digits of precision?

a)

int

b)

float

c)

double

d)

long

31.

In C++, what is the standard input stream object called?

a)

cout

b)

cin

c)

console

d)

input

32.

Which operator is used with the cin object to get input from the keyboard?

a)

The insertion operator (<<)

b)

The assignment operator (=)

c)

The extraction operator (>>)

d)

The addition operator (+)

33.

What is the purpose of the modulus operator (%)?

a)

To multiply two integers.

b)

To find the remainder of a division between two integers.

c)

To perform a calculation and assign the result to a variable.

d)

To divide two integers and get a decimal result.

34.

What is the correct C++ statement to display "Hello World" on the computer screen?

a)

cin >> "Hello World";

b)

cout << "Hello World";

c)

cout >> "Hello World";

d)

cin << "Hello World";

35.

What is a logic error?

a)

An error that occurs if an instruction violates the programming language's syntax.

b)

An error that occurs if an instruction does not give the expected results.

c)

An error that is found by a compiler.

d)

A bug that is automatically fixed.

36.

What is a syntax error?

a)

An error that occurs if an instruction does not give the expected results.

b)

An error that is always found during runtime.

c)

An error that occurs when an instruction violates the programming language's rules.

d)

An error that cannot be located or removed.

37.

What is a comment in C++?

a)

A type of variable.

b)

A keyword.

c)

A message to the person reading the program, ignored by the compiler.

d)

A statement that must end with a semicolon.

38.

The #include directive is used for which purpose?

a)

To declare a variable.

b)

To indicate the main function.

c)

To include the contents of the iostream file, which is needed for cin and cout objects.

d)

To define a namespace.

39.

What is the main function in a C++ program?

a)

It is an optional part of a program.

b)

It is where the execution of a C++ program always begins.

c)

It can be found in a header file.

d)

A C++ program can have multiple main functions.

40.

What is the purpose of the return 0; statement in a C++ main function?

a)

To end the program with an error.

b)

To pause program execution.

c)

To return the number 0 to the operating system to indicate that the program ended normally.

d)

To declare an integer variable named 0.