MCQ Bank
The control of a loop consists of the __________ activities.
- A) Three
- B) Two
- C) Four
- D) Five
What is the significance of the statement "f = f * i" in each iteration of the loop in the given pseudocode? f = 1 i=1; While (i<=n) f=f*i; i=i+1;
- A) It subtracts the loop counter "i" from the current value of "f"
- B) It has no impact in the loop
- C) It multiplies the current value of "f" by the loop counter "i"
- D) It resets the value of "f" to 1
Which of the following case does not exist in complexity theory?
- A) Null case
- B) Best case
- C) Worst case
- D) Average case
What is the ultimate goal when sorting a list within itself using the insertion sort algorithm?
- A) Shuffling entries
- B) Clearing off space
- C) Efficient use of storage space
- D) Efficient use of time to sort a list in quick time
Which loop structure refers as a pretest loop?
- A) Do while
- B) For each
- C) For
- D) While
Let a unsorted list Fred, Alex, Diana ,Byron ,Carol
Which one will be sorted at last
- A) Carol
- B) Fred
- C) Alex
- D) Diana
What condition triggers the termination of the sequential search algorithm as a failure on an ordered list of names?
- A) Equality of TargetValue and TestEntry
- B) TestEntry is smaller than TargetValue
- C) List is empty
- D) Reaching a name greater than the target name
How many times will the loop in the example below execute? int i=2; while(i<=5) { cout<<i; i=i+1; }
- A) 5 times
- B) 3 times
- C) 4 times
- D) 6 times
Float CGPA=3.5;
If (CGPA>=3.0)
Cout<<”Give Scholarship”;
Else
Cout<<”Sorry you do not qualify for the scholarship”;
It will show
- A) Good
- B) Display none
- C) Give Scholarship
- D) Sorry you do not qualify for the scholarship
In the context of the insertion sort algorithm, what is the restriction imposed on sorting a list?
- A) Make a tree of the list to sort entries
- B) Create a copy of the list to sort items one by one into the new list
- C) Sort using the same storage space without extra memory space
- D) Insertion sort can only be used on the list containing numeric values
What will be the output of following pseudo code?
def FindFactorial():
fact = 2
i=1;
While (i<=7)
fact=fact*i;
i=i+1;
print(fact)
- A) 120
- B) 980
- C) 10080
- D) 5040
How many relational operator are offered by C++?
- A) 4
- B) 2
- C) 6
- D) 8
Which of the following is the correct syntax for conditional statement?
- A) If (condition)
- B) If (condition Statement A Else Statement B.
- C) If condition) Statement A Else Statement B.
- D) If (condition) Statement A Else Statement B.
What is the output of the following code?
int sum =7;
if ( sum >= 20 )
cout<<"You win ";
if ( sum < 20 )
cout<<"You lose ";
cout<<"the prize.";
- A) You lose
- B) You lose the prize.
- C) You win the prize.
- D) You win
A program logic written in an ordinary language illustrating a structure similar to computer instructions is known as…….
- A) Pseudo codes
- B) Programs
- C) Flowcharts
- D) Algorithms
In the context of program development, what is the goal of finding a general algorithm?
- A) To solve a particular instance of a problem.
- B) To develop an algorithm that can solve all instances of a problem.
- C) To find a specific solution for each instance.
- D) To solve a specific problem without decomposition.
What is the expected outcome of "f" for the given pseudo-code if n = 5? f = 1 i=1; While (i<=n) f=f*i; i=i+1;
- A) 5
- B) 24
- C) 720
- D) 120
If While (i<=n) ,The loop will keep executing until “i” remains
- A) Less than n
- B) Greater than and equal to n
- C) Equal to n
- D) Less than or equal to n
Sequential Search Algorithm technique _________ in success.
- A) is fast
- B) does not always result
- C) is always optimal
- D) always result
What will be the output of the following pseudo code?
{20, 58, 90, 10, 15, 87, 30, 12, 98}
Count = 0
For number in list
If (number >=50)
Count=count+1
- A) 2
- B) 4
- C) 5
- D) 3