wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

MIDTERM REVISION

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What approach does Merge Sort use?
(Merge Sort hangi yaklaşımı kullanır?)

a)

Early stopping

b)

Divide & Conquer

c)

In-place, stable

d)

Greedy

2.

Worst-case execution of Merge Sort:
(Merge Sort'un en kötü durum çalışması:)

a)

O(n)

b)

O(n²)

c)

O(n log n)

d)

O(2ⁿ)

3.

What is the purpose of the key variable in Insertion Sort?
(Insertion Sort’ta key değişkeni hangi amaçla kullanılır?)

a)

To perform the merge step.

b)

It is the pointer that moves through the array.

c)

It holds the new element to be inserted.

d)

It holds the swap count.

4.

What is the purpose of the swaps flag used in Bubble Sort? (Bubble Sort'ta kullanılan swaps bayrağı ne işe yarar?)

a)

Calculating the array size

b)

Splitting the array in half

c)

Terminating the loop early if no elements have been changed

d)

Storing the key element

5.

Which of the following does not belong to the Divide & Conquer structure? (Aşağıdakilerden hangisi Divide & Conquer yapısına ait değildir?)

a)

break the problem apart

b)

solve subproblems

c)

combine solutions

d)

solve with only one repeat

6.

What approach does Bubble Sort use?

a)

Early stopping

b)

Divide & Conquer

c)

In-place, stable

d)

Greedy

7.

What approach does Insertion Sort use?

a)

Early stopping

b)

Divide & Conquer

c)

In-place, stable

d)

Greedy

8.

What is the purpose of size-i-1 in the bubble sort expression:
(Bubble Sort içinde geçen size-i-1 ifadesinin amacı nedir?

a)

This is to use memory more efficiently and reduce processing overhead by resizing the array at each outer loop step.

b)

It increases the array size.

c)

It reduces the number of swaps.

d)

Since the largest element is placed at the end of each iteration, it is not rechecked.

9.

The merge function creates two subarrays: What are these subarrays used for?
(Merge fonksiyonunda iki alt dizi oluşturuluyor: Bu alt diziler hangi amaçla kullanılır?)

a)

Reducing the size of the array.

b)

Reducing memory usage.

c)

Recording the number of swaps.

d)

Temporarily storing the left and right subarrays.

10.

The following merge loop guarantees which one?
(Aşağıdaki merge döngüsü: Neyi garanti eder?)

a)

The array is not reversed.

b)

The elements are merged stably.

c)

Memory is reduced.

d)

Time complexity is not linear.

11.

What does the Merge Sort function do, in that order?
(Merge Sort fonksiyonu sırasıyla ne yapar?)

a)

Split the array → Copy from left to right → Print

b)

Split → Sort → Merge

c)

Swap → Sort → Print

d)

Print → Sort → Swap

12.

Why does Merge Sort use m+1 in recursive calls?
(Merge Sort recursive çağrılarda neden m+1 kullanır?)

a)

To skip the middle element

b)

To free memory

c)

To indicate the beginning of the right substring

d)

To ensure linear code execution

13.

Why is Merge Sort recursive?
(Merge Sort neden recursive’dir?)

a)

It sorts sub-arrays by calling itself.

b)

Memory management is automatic.

c)

It requires fixed-size arrays.

d)

Because it does not require swap operation.

14.

Which sorting algorithm does the given pseudocode belong to? (Verilen pseudocode hangi sıralama algoritmasına aittir?)

a)

Bubble Sort

b)

Merge Sort

c)

Insertion Sort

d)

Selection Sort

15.

What is guaranteed when the condition given in the merge function is fulfilled? (Merge fonksiyonunda verilen şartı tamamlandığında ne garanti edilir?)

a)

The elements are reversed.

b)

The sorting is complete.

c)

At least one sub-array is exhausted.

d)

Both sub-arrays are completely exhausted.

16.

The following Insertion Sort inner loop: in which case it will not work?
(Aşağıdaki Insertion Sort iç döngüsü: hangi durumda çalışmaz?)

a)

If key is less than or equal to the element to its left

b)

If j == 0

c)

If i == 0

d)

If the array is not sorted

17.

What is the purpose of the following code snippet in a C++ program?
(Aşağıdaki kod parçası C++ programında ne amaçla kullanılır?)

a)

It is used to populate the array by assigning each input from the user to its corresponding index in the array.

b)

It automatically sorts all elements in the array from smallest to largest and prints them to the screen.

c)

It doubles the size of the array in memory, allocates new memory space, and copies the elements.

d)

It is used to process only the middle elements of the array and ignore the remaining elements.

18.

What is the purpose of this function in that line?
(Bu fonksiyonun ilgili satırdaki amacı nedir?)

a)

Deletes the elements of the array and frees the memory.

b)

Divides the array into two sub-arrays, preparing them for the merge operation.

c)

Prints the sorted array to the screen, showing the final state of the array.

d)

Sorts the array and simultaneously recreates it in memory.

19.

What will be the output of this code?

a)

1 1

b)

0 9

c)

1 9

d)

0 1

20.

Is there an error in the loop written to fill the elements of the array with a certain size?
(Boyutu belli olan (size) dizinin elemanlarını doldurmak için yazılan döngüde hata var mıdır?)

a)

No error

b)

There is a risk of out-of-bounds

c)

No input is received

d)

Only one element is read

21.

What will be the output of this code?

a)

2

b)

7

c)

1

d)

2 1

22.

What is arr after the following steps?
Start:

int arr[3] = {4, 3, 1}

Step:

swap(arr[0], arr[1])

After:

swap(arr[1], arr[2])

a)

1 4 3

b)

3 4 1

c)

3 1 4

d)

4 1 3

23.

What is wrong with this code?

a)

The swaps variable is defined incorrectly.

b)

The second parameter is missing in the bubbleSort(arr); call.

c)

The definition of arr[n] is incorrect because n is not a constant.

d)

The for loop must have i <= n.

24.

What is the purpose of this code?

a)

Add two numbers and print the result.

b)

Reset the values ​​of variables.

c)

Create a new array in memory.

d)

Swap the values ​​of two integer variables.

25.

What is the output of this code?

a)

0

b)

1

c)

2

d)

3