MCQ Bank
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
What is the significance of the term "posttest" in loop structures?
- A) Loop testing performed in parallel
- B) Test for termination after loop execution
- C) Test for termination before loop execution
- D) Continuous testing during loop execution
Why is the else-statement used in an if-statement?
- A) To execute a block of code if the condition is false
- B) To handle errors in the program
- C) To execution a block of code multiple times
- D) To execute a block of code if the condition is true
What is the purpose of the given pseudo-code? f = 1 i=1; While (i<=n): f=f*i; i=i+1;
- A) To sort the number list
- B) To identify prime numbers
- C) To determine the maximum value in a list
- D) To calculate the factorial of a given number
How many comparisons are required to sort the elements using insertion sort algorithm?
13, 10, 9, 6, 33, 100
- A) 9
- B) 5
- C) 7
- D) 3
What will be the output of the following pseudocode? marks = 60 if (marks>60) Print(You have passed the examination) Else Print(You have failed the examination)
- A) Both messages will be displayed
- B) No message will be displayed
- C) You have failed the examination
- D) You have passed the examination
What is the ASCII code for alphabet “A”?
- A) 64
- B) 62
- C) 63
- D) 65
What is the purpose of the program given below? if (CGPA>=3.0) cout<<”Give Scholarship”; else cout<<”Sorry you do not qualify for the scholarship”;
- A) Determine if a student qualifies for a scholarship
- B) Calculate the CGPA of a student
- C) Print a student's semester grades
- D) Provide information about university policies
How does a while statement in a loop structure work?
- A) It executes the body only once.
- B) It ignores the condition and executes the body indefinitely.
- C) It checks the condition, then executes the body.
- D) It executes the body and then checks the condition.
What approach does the imperative paradigm uses for the programming process?
- A) Finding an algorithm and expressing it as a sequence of commands
- B) Object-oriented approach
- C) Linear scale development
- D) Functional programming approach
In computer programming, what comes after the "if" keyword in an if-statement?
- A) Else
- B) StatementA
- C) Condition
- D) StatementB
Which one of the following is the traditional approach of programming process?
- A) Functional paradigm
- B) Object oriented paradigm
- C) Imperative Paradigm
- D) Declarative paradigm
In the Java programming language, what is the equivalent term for an "activation" in the context of concurrent processing?
- A) Function
- B) Thread
- C) Task
- D) Operation
Let a list Fred, Alex, Diana ,Byron ,Carol
After sorted first sublist our list would be
- A) Fred, Alex, Diana ,Byron ,Carol
- B) Alex, Fred, Diana ,Byron ,Carol
- C) Alex ,Fred ,Byron, Diana, Carol
- D) Alex, Diana , Fred, Byron ,Carol
What is the role of the semicolon in an assignment statement in most imperative languages?
- A) Marks the end of the program
- B) Initiates a loop
- C) Represents a comment
- D) Separates statements
What does the cyclic pattern of a loop involve?
- A) Checking the condition only at the end of the loop.
- B) Ignoring the condition and executing the body.
- C) Repeatedly checking the condition and executing the body.
- D) Executing the body continuously without interruption.