NEW
Font size
S
M
L
XL
Worksheets2.1 Algorithms Alt
Total questions: 56
Worksheet time: 28mins
Name
Class
Date
1.
1.What is computational thinking?
a)
A.A thought process involved in formulating a problem and expressing its solution
b)
B.Thinking like a computer in binary form
c)
C.Instructing the computer to solve a problem
2.
2.Which of the following is TRUE about software development?
a)
A.It is a complex process.
b)
B.It requires innovative thinking.
c)
C.Complex testing procedures are involved.
d)
D.All of the above
3.
3.Which of the following is NOT a component of computational thinking?
a)
A.Programming
b)
B.Algorithm design
c)
C.Abstraction
d)
D.Decomposition
4.
4.Breaking a large problem is broken down into smaller chunks is called as …………………..
a)
A.Algorithm design
b)
B.Decomposition
c)
C.Computational thinking
d)
D.Abstraction
5.
5.Which of the following is similar to generalisation?
a)
A.Decomposition
b)
B.Algorithm design
c)
C.Abstraction
d)
D.Computational thinking
6.
6.What is abstraction?
a)
A.Removing certain characteristics from objects are removed so that the set of characteristics is reduced to a simple form.
b)
B.Sets of logical instructions for a computer.
c)
C.Thinking like a computer.
7.
7.What is an algorithm?
a)
A.Data given to a system
b)
B.Steps followed to think like a computer
c)
C.Step by step instructions given to a computer
8.
8.Which of the following is NOT a characteristic of a complete solution?
a)
A.Correctness
b)
B.Presence of logical errors
c)
C.Efficient
d)
D.Reusability
9.
9.Which of the following is the first step in solving a problem?
a)
A.Understand the problem
b)
B.Constructing a plan to solve the problem
c)
C.Apply the plan
d)
D.Checking for errors and improving the problem
10.
10.How does a developer construct a plan to solve a problem?
a)
A.By checking whether this type of problem has been solved earlier.
b)
B.Using mathematics
c)
C.By thinking of an algorithm to solve the problem
d)
D.All of the above
11.
11.Which of the following is an example of abstraction?
a)
A.Network layering
b)
B.Distributing components of a software to each developer in a team
c)
C.Developing a program for dividing two numbers
12.
12.What is the difference between flowchart and pseudocode?
a)
A.A flowchart depicts the problem solving methodology in pictorial form. Whereas, pseudocode represents algorithm using simple words and mathematical operators.
b)
B.A flowchart depicts the steps of an algorithm in pictorial form. Whereas, pseudocode represents algorithm using simple words and mathematical operators.
c)
C.A flowchart depicts the steps of an algorithm in pictorial form. Whereas, pseudocode represents the problem solving methodology.
13.
13.Complete this sentence: A decision box has …………. entry point and ………… exit points.
a)
A.one, two
b)
B.one, one
c)
C.two, one
d)
D.None of the above
14.
14.Complete this sentence: …………. operator is used to find remainder of a division operation.
a)
A.DIV
b)
B.MUL
c)
C.MOD
d)
D.ADD
15.
15.What is the advantage of reusing solutions?
a)
A.Saves time
b)
B.Simplifies developer’s work
c)
C.Reduces errors
d)
D.All of the above
16.
1.In which of the following cases, linear search algorithm is used?
a)
A.To search an element in an unordered list.
b)
B.To search an element in a list of few elements.
c)
C.Well suited for almost all types of list.
d)
D.To search an element in unordered list consisting of few elements.
17.
4.A linear search algorithm takes two inputs: one is a ordered list and another one is unsorted list. Which of the two will be searched faster?
a)
A.Sorted list
b)
B.Unsorted list
c)
C.Depends on the position of item to be searched
18.
5.Under which of the following conditions is a linear search complete?
a)
A.Item is found
b)
B.Item is not present in the list
c)
C.A or B
19.
10.Which of the following is TRUE about linear search algorithm?
a)
A.Linear search algorithm checks each element one by one.
b)
B.The worst case scenario of a linear search occurs if the item is not in the list.
c)
C.The worst case scenario of a linear search occurs if the item is the last element of the list.
d)
D.All of the above
20.
1.In which of the following cases, binary search algorithm is used?
a)
A.To search an element in an unordered list.
b)
B.To search an element in a list of few elements.
c)
C.To search an element in any ordered list with large number of elements.
d)
D.None of the above
21.
2.How does a binary search algorithm works?
a)
A.Dividing the list into halves until the item is matched with one in the list.
b)
B.Starts with the first element and checks the next element consecutively until a match is found.
c)
C.None of the above
22.
3.An array with 32 elements is input to a binary search algorithm. How many maximum number of comparisons are performed?
a)
A.32
b)
B.16
c)
C.8
d)
D.5
23.
4.An array with 32 elements is input to a linear search algorithm. How many maximum number of comparisons are performed?
a)
A.32
b)
B.16
c)
C.8
d)
D.5
24.
5.How is the midpoint of the list calculated?
a)
A.midpoint= round ((first_element+last_element)/2)
b)
B.midpoint=(lower_bound+upper_bound)/2
c)
C.midpoint= round ((lower_bound+upper_bound)/2)
d)
D.midpoint= round ((lower_bound+upper_bound))
25.
6.Under which of the following conditions, binary search algorithm terminates?
a)
A.Item_found=true
b)
B.lower_bound <= upper_bound
c)
C.lower_bound > upper_bound
d)
D.A and C
26.
7.Complete the sentence: The lower half of the list is discarded if the value at midpoint is …………………….. item searched.
a)
A.less than
b)
B.greater than
c)
C.equal to
27.
8.True or False: The upper half of the list is discarded if the value at midpoint is greater than item searched.
a)
A.True
b)
B.False
c)
C.None of them
28.
9.Which of the following statement is executed when list[midpoint] < item?
a)
A.item_found=true
b)
B.lower_bound=midpoint+1
c)
C.upper_bound=midpoint-1
d)
D.None of the above
29.
10.Which of the following statement is executed when list[midpoint] > item?
a)
A.item_found=true
b)
B.lower_bound=midpoint+1
c)
C.upper_bound=midpoint-1
d)
D.None of the above
30.
11.What is the disadvantage of binary search algorithm?
a)
A.It takes longer time when compared to linear search algorithm
b)
B.It works only on sorted lists
c)
C.It is very complex to understand
d)
D.None of the above
31.
1.Which of the following is the correct intermediate steps for performing bubble sort on the data set: 12, 56, 24, 38, 10
a)
A.12, 24, 38, 10, 56; 12, 24, 10, 38, 56; 12, 24, 10, 38, 56; 12, 10, 24, 38, 56 & 10, 12, 24, 38, 56
b)
B.12, 24, 38, 10, 56; 12, 24, 10, 38, 56; 12, 24, 10, 38, 56; 12, 10, 24, 38, 56; 10, 12, 24, 38, 56 & 10, 12, 24, 38, 56
c)
C.12, 24, 38, 10, 56; 12, 24, 10, 38, 56; 10, 12, 24, 38, 56 & 10, 12, 24, 38, 56
d)
D.12, 24, 38, 10, 56; 12, 24, 10, 38, 56; 12, 24, 10, 38, 56; & 10, 12, 24, 38, 56
32.
2.How many loops do we need for bubble sort algorithm?
a)
A.1 while loop
b)
B.1 for loop
c)
C.1 while loop with a nested for loop
d)
D.Any two separate loops
33.
3.What operation is performed using for loop in bubble sort algorithm?
a)
A.Elements are compared with its next element.
b)
B.Checks swapflag
c)
C.Elements are compared with its next element and swapped if necessary
34.
4.What condition is checked exactly at while loop in bubble sort algorithm?
a)
A.Checks swapflag
b)
B.Checks whether current element is the last element
c)
C.Checks whether swapping is required or not
35.
5.Under which of the following condition, does while loop in bubble sort algorithm ends?
a)
A.swapflag=true in the nested for loop
b)
B.swapflag=false in the nested for loop
c)
C.position = length_of_list-2
d)
D.None of the above
36.
6.Which of the following conditions represents the last loop of bubble sort?
a)
A.One last swapping in the list
b)
B.Only two swapping in the list
c)
C.No swapping in the list
d)
D.None of the above
37.
7.In which of the following cases, are the numbers swapped in bubble sort?
a)
A.Current element is greater than the next element
b)
B.Current element is less than the next element
c)
C.Current element is equal to the next element
d)
D.None of the above
38.
1.How many lists do we require to implement insertion sort algorithm?
a)
A.1
b)
B.2
c)
C.3
d)
D.None of the above
39.
2.How many loops do we need for implementing insertion sort algorithm?
a)
A.1 while loop
b)
B.1 for loop
c)
C.A while loop with a nested while loop
d)
D.Any two separate loops
40.
3.What operation is used to move elements from unsorted list to sorted list?
a)
A.Comparison
b)
B.Swap
c)
C.Both A and B
41.
4.What element from the unsorted list is transferred first to sorted list?
a)
A.First element
b)
B.Smallest element
c)
C.Largest element
42.
6.Under which of the following condition, does the insertion sort algorithm ends?
a)
A.The sorted list is empty
b)
B.The unsorted list is empty
c)
C.None of the above
43.
7.Consider the list: 6 4 1 8 2. What are the intermediate steps of insertion sort algorithm? The symbol || separates sorted list and unsorted list.
a)
A.6||4 1 8 2, 4 6 || 1 8 2, 1 4 6||8 2 , 1 2 4 6 || 8 and 1 2 4 6 8
b)
B.6||4 1 8 2, 4 6 || 1 8 2, 1 4 6||8 2 and 1 2 4 6 8
c)
C.6||4 1 8 2, 4 6 || 1 8 2 , 1 2 4 6 || 8 and 1 2 4 6 8
d)
D.None of the above
44.
8.For a list of 5 elements, what are the maximum of swapping are performed?
a)
A.5
b)
B.7
c)
C.8
d)
D.10
45.
9.For a list of 6 elements, what are the maximum of comparisons are performed?
a)
A.5
b)
B.10
c)
C.15
d)
D.21
46.
10.An intermediate step in insertion algorithm is: 3 4 5 6|| 2. What are the next steps towards the completion of algorithm?
a)
A.3 4 5 2 6, 3 4 2 5 6, 3 2 4 5 6 and 2 3 4 5 6.
b)
B.3 4 5 2 6 , 3 2 4 5 6 and 2 3 4 5 6.
c)
C.3 4 5 2 6, 3 4 2 5 6 and 2 3 4 5 6.
47.
1.How many steps are involved in merge sort algorithm?
a)
A.1
b)
B.2
c)
C.3
d)
D.None of the above
48.
2.Which of the following denotes the steps followed by merge sort algorithm?
a)
A.Merge -> Sort
b)
B.Divide -> Sort -> Merge
c)
C.Sort -> Divide -> Merge
d)
D.Divide -> Merge
49.
3.In the last division, how many elements remain in a set?
a)
A.1
b)
B.2
c)
C.3
d)
D.4
50.
4.To implement merge sort algorithm for 8 elements how many lists do your require?
a)
A.3
b)
B.4
c)
C.5
d)
D.6
51.
5.Complete this pseudocode of merge sort algorithm:
a)
if the first item in list 1< the first element in list 2 then
b)
……………………………………………………………………..
c)
A.remove the first item from list 1 and add to the newlist
d)
B.remove the first item from list 2 and add to the newlist
e)
C.remove the second item from list 1 and add to the newlist
52.
6.How many while loops do you require to implement merge sort algorithm for a list of 4 elements?
a)
A.1
b)
B.2
c)
C.3
53.
7.Under which conditions, does while loop of merge sort algorithm terminates?
a)
A.List 1 or list 2 is empty
b)
B.Both list 1 and list 2 is empty
c)
C.Both list 1 and list 2 is not empty
d)
D.None of the above
54.
8.Under which conditions, does merge sort algorithm terminates?
a)
A.List 1 or list 2 is empty
b)
B.Both list 1 and list 2 is empty
c)
C.Both list 1 and list 2 is not empty
d)
D.None of the above
55.
9.What happens when list1 is empty but still an element is left in list2?
a)
A.The element in list 2 is discarded
b)
B.The element in list 2 is added to new list
c)
C.The algorithm is checked once
d)
D.Error message is printed
56.
10.How many if… else… statements are required in implementation of merge sort algorithm for a list of 4 elements?
a)
A.A separate if… else… statement
b)
B.2 separate if… else… statements
c)
C.2 separate if… else… statements, in which one of them is inside while loop
d)
D.None of the above
Reset
