MCQ Bank
The initialization step in loop structure establishes a starting ________.
- A) Condition
- B) Body
- C) Function definition
- D) Total Number of code lines
Which programming construct is given below? If(condition) Statement A else Statement B
- A) Pointer
- B) Function
- C) Loop structure
- D) Control structure
What is collectively called an assembly language in the context of programming?
- A) Mnemonic system
- B) Compiler
- C) Machine language
- D) High-level language
Which organizations have adopted and published standards for popular programming languages to address the lack of agreement on language definitions?
- A) Compiler Writers Association
- B) International Compiler Consortium
- C) Programming Language Alliance
- D) American National Standards Institute (ANSI) and International Organization for Standardization (ISO)
Why is the Therac-25 incident considered a software failure?
- A) It resulted in a man's death.
- B) The software was believed to be correct.
- C) It occurred in Texas.
- D) There was a technical issue in the software.
What is the role of the test activity in loop control?
- A) To initialize the loop
- B) To execute the loop repeatedly
- C) To modify the loop body
- D) To compare the current state to the termination condition
As a general rule, the use of ___________ produces a higher degree of flexibility that would be obtained merely by explicitly writing the body several times.
- A) Sequential statements
- B) Loop structure
- C)
- D)
In binary search, first of all value check at a point
- A) Most left
- B) Middle
- C) Most right
- D) Beginning
How many times will the loop in the example below execute? int counter=1; while(counter<=5) { cout<<counter; counter=counter+2; }
- A) 4 times
- B) 3 times
- C) 6 times
- D) 5 times
What does a control statement do in a program?
- A) Alters the execution sequence of program
- B) Performs arithmetic operations
- C) Prints output to the console
- D) Declares variables
When applied to a list with n entries, the sequential search algorithm will interrogate an average of ------ entries
- A) 2n
- B) N/2
- C) N*n
- D) N
Which term is commonly used for a loop where the termination test is performed before the body is executed?
- A) Preliminary loop
- B) Precondition loop
- C) Prerequisite loop
- D) Pretest loop
Which programming language was developed for scientific and engineering applications?
- A) Assembly Language
- B) COBOL
- C) FORTRAN
- D) Machine language
In the provided pseudo-code, what is the role of the "Current" variable? def FindMax(): max = first number in the list Current = second number in the list While (elements in the list exist) If (max<current) max=current Current = next value in the list
- A) It indicates the position of the current element in the list
- B) It represents the minimum value in the list
- C) It holds the maximum value in the list
- D) It stores the current value being compared
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