wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PROGRAMMING Reviewer

Total questions: 22

Worksheet time: 11mins

Name
Class
Date
1.

It is used to execute both the true part and the false part of a given condition. It is used turn run one block of code under certain conditions and another block of code under different conditions.

a)

If-else statement

b)

Else statement

c)

Else if statement

2.

An object-oriented programming (OOP) language that is viewed by many as the best language for creating large scale applications.

a)

Java

b)

Python

c)

C++

3.

It is a key part of the decision-making process from programs.

a)

Statement

b)

Condition

c)

If-else

4.

A group of expressions and/or _________ that you design to carry out a task or an action.

a)

Statement

b)

Condition

c)

If-else

5.

What does an if-else statement evaluate in C++?

a)

It evaluates a condition and execute a block of code based on the result

b)

It evaluates whether a variable is true or false

6.

How can you write a nested if-else statement in C++?

a)

By using a single if-else statement with multiple conditions

b)

By placing one if-else statement inside another if-else statement

7.

Why is it important to use curly braces () in an if-else statement even if there is only one statement inside?

a)

To ensure correct scoping and avoid unexpected behavior

b)

To make the code run faster and to improve code readability

8.

Why might you choose to use if-else ladder instead of nested if-else statements in certain situations?

a)

To increase code complexity

b)

To handle multiple mutually exclusive conditions more efficiently

9.

TRUE or FALSE: Bubble sort is a stable sorting algorithm.

a)

True

b)

False

10.

TRUE or FALSE: Insertion sorting is more efficient than insertion sort for sorting small data sets.

a)

True

b)

False

11.

TRUE or FALSE: Selection sort has a good case time complexity of O(n^2)

a)

True

b)

False

12.

TRUE or FALSE: Bubble sort always performs better than selection sort.

a)

True

b)

False

13.

TRUE or FALSE: Insertion sort performs better than bubbles sort for nearly sorted arrays.

a)

True

b)

False

14.

It is used to rearrange a given array or a list of elements according to a comparison operator on the elements. This help in arranging data in a specific order, making it easier and faster to search, retrieve, and analyze information.

a)

Sorting Algorithm

b)

Insertion Sort

c)

Selection Sort

15.

A sorting algorithm which is commonly used in computer science; it is based on the idea of repeatedly comparing pairs of adjacent elements and then swapping their positions if they exist in the wrong order.

a)

Bubble Sort

b)

Insertion Sort

c)

Selection Sort

16.

It is a sorting algorithm which sorts the arrays by shifting the elements one at a time.

a)

Bubble Sort

b)

Insertion Sort

c)

Selection Sort

17.

It is a simple comparison-based sorting algorithm that works by dividing the input list into two parts: This sorted part and unsorted part.

a)

Bubble Sort

b)

Insertion Sort

c)

Selection Sort

18.

Which of the following best describes the operation of the bubble sort algorithm?

a)

It repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order

b)

It select the maximum element and moves it to the end of the list in each iteration

19.

How does the selection sort algorithm work?

a)

It divides the list into two sub lists, repeatedly merging them to achieve a sorted array

b)

It selects the minimum element and swaps it with the leftmost unsorted element

20.

In selection sort, which of the following best describes the key operation?

a)

Selecting the minimum element and placing it at the beginning

b)

Dividing the array into two subarrays and merging them

21.

What is the key idea behind the insertion sort algorithm?

a)

It divides the array into two subarrays and recursively sorts them

b)

It inserts elements into their correct position one at a time

22.

How does insertion sort work?

a)

It finds the maximum element in moves it to the end of the array

b)

It builds the final sorted array one element at a time by inserting elements into the correct position