0% found this document useful (0 votes)
42 views5 pages

MCQ in UNIT1

Uploaded by

swarna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views5 pages

MCQ in UNIT1

Uploaded by

swarna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

MCQ in UNIT-1 PYTHON

1. Which of the following is NOT a basic building block of algorithms?


o a) Sequence
o b) Decision
o c) Iteration
o d) Compilation
2. An algorithm is said to be __________ if it guarantees a solution for every input in a
finite number of steps.
o a) Finite
o b) Correct
o c) Complete
o d) None of the above
3. The term "sequence" in algorithms refers to:
o a) Repetition of steps
o b) Performing one operation after another
o c) Making decisions
o d) None of the above
4. Which control structure allows the algorithm to choose between two or more
alternatives?
o a) Sequence
o b) Decision
o c) Iteration
o d) Recursion
5. Which of the following is a correct definition of "iteration" in algorithms?
o a) A process that repeats a sequence of instructions a certain number of times
o b) Choosing between different branches of execution
o c) A step-by-step procedure to solve a problem
o d) Recursively breaking down problems
6. Pseudocode is used to:
o a) Write programs in natural language
o b) Illustrate the logic of an algorithm
o c) Create a formal code in programming languages
o d) Execute algorithms directly
7. Which symbol in a flowchart represents a decision?
o a) Rectangle
o b) Diamond
o c) Oval
o d) Circle
8. In a flowchart, an oval shape usually represents:
o a) A decision
o b) A start or end point
o c) A process
o d) A loop
9. Which of the following is TRUE about pseudocode?
o a) It must follow strict syntax like a programming language
o b) It focuses on the logic of the algorithm without syntax rules
o c) It can be directly executed by a computer
o d) It is a graphical representation of an algorithm
10. A function in programming is:
o a) A step-by-step execution
o b) A block of code that performs a specific task
o c) A process that repeats indefinitely
o d) None of the above
11. Which of the following correctly represents a loop in pseudocode?
o a) If condition then
o b) While condition do
o c) Function call
o d) Return result
12. What is the purpose of a flowchart?
o a) To write the complete code
o b) To visually represent the flow of an algorithm
o c) To compile programs into machine language
o d) To execute pseudocode

13. Iteration is commonly used when:


o a) We need to repeat certain instructions multiple times
o b) A problem is broken down into subproblems
o c) The solution is expressed in terms of itself
o d) We have only one condition to check
14. In recursion, the function calls itself until:
o a) The program crashes
o b) A base condition is met
o c) An infinite loop occurs
o d) None of the above
15. Which of the following is an example of an iterative control structure?
o a) If-Else
o b) For loop
o c) Switch
o d) Break
16. What is the main characteristic of a recursive function?
o a) It contains a loop
o b) It calls itself with a modified parameter
o c) It cannot have a base condition
o d) It is always more efficient than iteration
17. Which of the following algorithms is based on recursion?
o a) Linear search
o b) Binary search
o c) Selection sort
o d) Bubble sort
18. What is the base case in recursion?
o a) A case that simplifies the problem
o b) The last function call
o c) The condition at which recursion stops
o d) The maximum recursion depth
19. Which strategy is usually more memory efficient, especially for large data?
o a) Iteration
o b) Recursion
o c) Both are equally efficient
o d) Neither is memory efficient
20. Which of the following represents a situation where recursion is better suited than
iteration?
o a) Repetitive tasks
o b) Large datasets
o c) Problems that can be broken into subproblems
o d) None of the above
21. Which of the following statements is TRUE about recursion?
o a) It always leads to a stack overflow
o b) It is used when a problem can be solved using a loop
o c) Recursive algorithms can lead to high memory usage due to stack calls
o d) Recursion is always more time-efficient than iteration
22. What is a common disadvantage of recursion?
o a) It is harder to understand
o b) It always leads to infinite loops
o c) It takes more time than iteration
o d) It uses more memory due to function call overhead

23. In an algorithm that uses both iteration and recursion, which is likely to run first?
o a) Iteration
o b) Recursion
o c) Both run simultaneously
o d) It depends on the algorithm
24. When solving problems with recursion, which component ensures the algorithm
doesn’t run indefinitely?
o a) Loop condition
o b) Base case
o c) Recursion depth
o d) Function return value
25. Which of the following is NOT an advantage of pseudocode?
o a) Easy to understand by non-programmers
o b) Language independent
o c) Can be executed by a compiler
o d) Focuses on the algorithm's logic
26. In the context of algorithms, what does modularity refer to?
o a) Breaking down a problem into independent modules
o b) Using recursion instead of iteration
o c) Optimizing memory usage
o d) Writing algorithms without using loops
27. Which of the following statements about functions is TRUE?
o a) Functions cannot be recursive
o b) Functions allow for code reusability
o c) Functions can only be used once in a program
o d) Functions increase code complexity
28. In algorithm design, which strategy can help break down a problem into smaller,
more manageable parts?
o a) Modularity
o b) Recursion
o c) Flowcharting
o d) Compilation
29. Which of the following will cause a recursive function to run indefinitely?
o a) No base case
o b) A break statement inside the function
o c) Using while loops
o d) All of the above
30. Which algorithm design strategy often leads to a divide-and-conquer solution?
o a) Iteration
o b) Recursion
o c) Decision-making
o d) Looping
31. Which of the following is NOT a valid characteristic of a good flowchart?

 a) Clarity and simplicity


 b) Unnecessary complexity
 c) Logical sequence of steps
 d) Correct use of symbols

32. Which of the following is TRUE about flowcharts?

 a) They provide a graphical representation of algorithms


 b) They can only be used for small problems
 c) They are not useful for representing decisions or loops
 d) They are used to execute algorithms

33. What symbol in a flowchart is used to indicate a predefined process or function


call?

 a) Oval
 b) Diamond
 c) Rectangle with double lines
 d) Parallelogram
34. What is the key advantage of using flowcharts?

 a) They are faster to execute than code


 b) They can represent complex processes in a simple visual format
 c) They are automatically converted to programming languages
 d) They are more accurate than pseudocode

35. The parallelogram symbol in a flowchart is used to represent:

 a) Decision
 b) Input or output
 c) Process
 d) Loop

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy