MCQ Bank
Polya’s analysis of problem solving is to evaluate the solution for
- A) Time
- B) Cost
- C) Consistency
- D) Accuracy
Under ________ paradigm a program is viewed as an entity that accepts inputs and produces outputs.
- A) Imperative
- B) Declarative
- C) Functional
- D) Object-Oriented
If the test for termination of a loop is executed after the execution of body then loop is known as……
- A) Pre-test loop
- B) Final loop
- C) Termination loop
- D) Post-test loop
There are….. iterations in following pseudo code.
def FindFactorial():
fact = 2
i=1;
While (i<=7)
fact=fact*i;
i=i+1;
print(fact)
- A) 7
- B) 3
- C) 5
- D) 2
What is the primary goal when sorting a list of names using the insertion sort algorithm?
- A) Create extra space for adding new names in the list
- B) Create a copy of the list for sorting
- C) Move the list to another location
- D) Shuffle entries to sort the list within itself
What will be the output of the following statement?
int a = 10 + 4.867;
- A) 14.867
- B) 14
- C) Compiler error.
- D) 10
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