MCQ Bank
What does the modification step in loop control accomplish?
- A) Establishes a starting condition
- B) Moves the condition toward the termination condition
- C) Compares the current state to the termination condition
- D) Terminates the loop
Why is the initialization step important in loop control?
- A) It executes the loop body
- B) It establishes a starting condition that will be modified toward the termination condition
- C) It compares the current state to the termination condition
- D) It ensures the termination of the looping process
If we have to insertion sort on names Fred, Alex, Diana ,Byron ,Carol
One approach to sorting this list is to note that the sublist consisting of
- A) Sub list having 3 names
- B) Only carol
- C) Both fred and alex
- D) Only top name
In what case "Give Scholarship" statement will be executed in the following code? if (CGPA>=3.0) cout<<”Give Scholarship”; else cout<<”Sorry you do not qualify for the scholarship”;
- A) For CGPA value 2.9 or less
- B) Both statements will be executed in any case
- C) For any CGPA value above three
- D) CGPA is less than three
What is the purpose of an assignment statement in programming?
- A) To terminate the program
- B) To assign a value to a variable
- C) To declare variables
- D) To request input from the user
How many iterations are required to find 88 in the following array?
{5, 6, 77, 88, 99}
- A) 1
- B) 4
- C) 3
- D) 2
Which of the following is not a relational operator in C++?
- A) %=
- B) > =
- C) ! =
- D) = =
Which of the following is the correct syntax to initialize a 3-element integer array in C/C++?
- A) int arr[3] = {1,2,3}
- B) int arr(3) = {1,2,3}
- C) int arr(3) = (1,2,3);
- D) int arr[3] = (1,2,3)
What is the output of the following code?
int sum = 14;
if ( sum < 20 )
cout<<"Under ";
if ( sum > 20 )
cout<<"Over ";
cout<<"the limit.";
- A) Under
- B) Over the limit
- C) Over
- D) Under the limit
The repetitive use of an instruction or sequence of instructions is an important algorithmic concept. One method of implementing such repetition is the iterative structure known as the ______.
- A) If else
- B) Class
- C) Condition
- D) Loop
Which of the following terms refers to the process in which a small request is initially made and detailed solution is shared later?
- A) Foot-in-the-door technique
- B) High-balling
- C) Low-balling
- D) Door-in-the-face technique
In the following C/C++ programming statement, what does Z represent? Z = X + Y;
- A) A variable
- B) A keyword
- C) A function
- D) A constant
Which of the following symbol is used as assignment operator in Ada.
- A) ,
- B) ;
- C) :=
- D) =
How many times will the loop in the example below execute? int i=1; while(i<=5) { cout<<i; }
- A) 3 times
- B) 4 times
- C) 5 times
- D) Infinite times
What are descriptive names like "Price," "ShippingCharge," and "TotalCost" often called in programming?
- A) Numeric forms
- B) Program variables or identifiers
- C) Mnemonics
- D) Machine codes
The imperative paradigm, also known as the Particular machine
- A) Procedural paradigms
- B) Non-Procedural paradigms
- C) Non traditional paradigms
- D) Traditional paradigms
Why does the composition of loop control deserve attention?
- A) It is the more error-prone part of the structure.
- B) It has no impact on the algorithm's performance.
- C) It is only relevant for simple algorithms.
- D) It is typically error-free and does not require attention.
Distinction between Program believed to be correct and the program that is correct is
- A) Software Modularity
- B) Software Verification
- C) Software Validation
- D) Software requirement gathering
What is the primary goal of the Sequential search algorithm?
- A) Randomizing list elements
- B) Searching for a specific target value
- C) Sorting a list
- D) Detecting duplicate entries
How is the termination condition reached in loop control?
- A) By skipping the test activity
- B) By executing the test activity
- C) By repeating the initialization step
- D) By applying the modification step repeatedly