Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

MCQ's Chapter 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Prof Muhammad Zubair Zaib

Chapter 2: Algorithm and Computational Thinking

1. The complexity of the algorithm depends upon


A) Time Only B) Both Time and Space C) Space Only D) None of The Above
2. An algorithm: can be represented through
A) Flow Charts B) Instructions in Common Language C) Pseudo-Codes D) All of The Mentioned Above
3. There are two algorithms suppose A takes 1.41 milliseconds while B takes 0.9 milliseconds, which one is better considering
all other things are the same?
A) A Is Better Than B B) B Is Better Than A C) None of The Mentioned D) Both Are Equally Good
4. Considering an array has 10 elements and the searching element is at array index 6. A starting element is present at Index
zero. How many comparisons are required to search an element using linear search?
A) 5 b) 6 c) 7 d) 8
5. In computer science, the computational artifacts could include:
A) Programs B) Videos C) Simulations D) Programs, Simulations and Videos
6. In the planning phase of computational artifact development, the following is included in:
A) Logic B) Control Structures C) Data Structures D) Logic, Data and Control Structures
7. Trace method is used to Trace method is used to:
A) Take Input B) Take A Print C) Hand Simulate the Execution Algorithm D) Align Margins
8. Trace Tables are used to__________________
A) Dry Run Algorithm B) Test If the Algorithm Is Giving Expected Output C) Show the Variables Change D) A, B And C
9. Algorithms are evaluated using
A) Correctness B) Efficiency C) A And B D) None of The Above
10. Which of the following best describes abstraction in computational thinking?
A) Breaking down a problem into smaller, more manageable parts
B) Ignoring details to focus on the main idea
C) Identifying patterns in data
D) Writing code in a specific programming language
11. What is the main goal of pattern recognition in computational thinking?
A) Simplifying complex problems B) Developing step-by-step solutions
C) Identifying trends and regularities in data D) Translating algorithms into code
12. In computational thinking, which process involves creating general solutions that can be reused in
different scenarios?
A) Decomposition B) Abstraction C) Pattern Recognition D) Algorithm Design
13. Which computational thinking concept is used when a problem is broken down into smaller, more
manageable parts?
A) Abstraction B) Pattern Recognition C) Decomposition D) Algorithm Design
Prof Muhammad Zubair Zaib

14. What is the purpose of algorithm design in computational thinking?


A) Identifying and ignoring irrelevant details B) Breaking down a problem into smaller parts
C) Creating a step-by-step procedure to solve a problem D) Recognizing patterns in data
15. What is a computational artifact?
A) A physical object used in computing B) Any software, document, or object created using computational tools and techniques
C) A hardware component of a computer D) A type of programming error
16. Which of the following is an example of a computational artifact?
A) A printed circuit board B) A user manual for software C) A computer program D) An algorithm in pseudocode
17. What is the primary purpose of creating computational artifacts?
A) To develop new hardware components
B) To solve specific problems or address particular needs
C) To document the history of computing
D) To perform physical computing tasks
18. Which process is involved in the creation of computational artifacts?
A) Debugging B) Hardware assembly C) Software design and implementation D) Data entry
19. What might be included in the documentation of a computational artifact?
A) The source code B) Design Specification C) User Instructions D) All of the above
20. Which of the following is the first step in planning a computational artifact?
A) Writing the code B) Testing the program C) Identifying the problem or need D) Documenting the design
21 During the planning phase, what is the primary purpose of creating a flowchart or pseudocode?
A) To compile the program B) To visually represent and organize the logic of the solution
C) To conduct performance testing D) To debug the code
22. What is an important consideration when selecting tools and technologies for developing a computational artifact?
A) Popularity of the tool B) Cost of the tool
C)Suitability for the specific problem and team's expertise D) Availability of online tutorials
23. Which of the following best describes iterative development in the context of creating a computational artifact?
A) Writing the entire codebase in one go B) Testing the program only after all features are complete
C) Repeatedly refining and improving the artifact through cycles of development and testing
D) Avoiding any changes once the initial design is complete.
24. Why is user feedback important in the development of a computational artifact?
A) It helps identify bugs in the hardware
B) It ensures the final product is popular
C) It provides insights into how well the artifact meets the needs and expectations of its intended users
D) It reduces the cost of development
Prof Muhammad Zubair Zaib

25. What is the primary purpose of testing a computational artifact?

A) To increase the size of the codebase


B) To ensure that the artifact works as intended and meets the specified requirements
C)To write more documentation
D) To evaluate the hardware components
26. Which type of testing involves evaluating individual components of a computational artifact to ensure they work correctly?
A) Integration testing B) System testing C) Unit testing D) User acceptance testing
27. What is the main focus of integration testing in the context of computational artifacts?
A) Checking the user interface for errors
B) Verifying that different components or modules work together correctly
C) Ensuring that the entire system functions as a whole
D) Assessing performance under high load
28. Which testing technique involves simulating real-world usage scenarios to ensure the computational artifact performs well
under expected conditions?
A) Stress testing B) Unit testing C) Regression testing D) User acceptance testing
29. What is a key benefit of automated testing for computational artifacts?
A) It eliminates the need for a testing team
B) It speeds up the testing process and increases test coverage
C) It replaces the need for user feedback
D) It reduces the size of the codebase
30. Which sorting algorithm repeatedly compares adjacent elements and swaps them if they are in the
wrong order?
A) Merge sort B) Quick sort C) Bubble sort D) Insertion sort
31. What is the average time complexity of bubble sort?
A) O (1) B) O(n log n) C)O(n^2) D)O(n^3)
32. In which scenario does insertion sort perform the best?
A) When the list is randomly ordered B) When the list is already sorted or nearly sorted
C) When the list is in reverse order D) When the list contains unique elements
33. What is the worst-case time complexity of insertion sort?
A) O (1) B) O (n log n) C)O(n^2) D)O(n^3)
34. Which sorting algorithm is considered more efficient for small or nearly sorted lists?
A) Quick sort B) Merge sort C) Insertion sort D) Heap sort
35. How does the performance of bubble sort change if an optimized version is used that stops early if no
swaps are made?
A) It improves to O(n log n) in all cases B) It remains O(n^2) in the average and worst cases
C) It improves to O(n) in the best case (when the list is already sorted) D) It becomes more complex to implement
36. Which sorting algorithm builds the final sorted array by repeatedly moving the current element to its correct position relative
to previously sorted elements?
A) Bubble sort B) Insertion sort C) Merge sort D) Selection sort
Prof Muhammad Zubair Zaib

37. What is the space complexity of bubble sort?


A) O(1) B) O(n) C) O(n log n) D) O(n^2)
38. Which search algorithm requires the list to be sorted in order to function correctly?
A) Linear search B) Binary search C) Both linear and binary search D) Neither
39. What is the average time complexity of linear search?
A) O (1) B) O(n) C) O(log n) D) O(n log n)
40. What is the time complexity of binary search in the worst case?
A) O (1) B) O(n) C) O(log n) D) O(n log n)
41. In which search algorithm does the search space reduce by half with each iteration?
A) Linear search B) Binary search C) Jump search D) Interpolation search
42. Which search algorithm is best suited for unsorted lists?
A) Binary search B) Linear search C) Both binary and linear search D) Neither
43. What happens in binary search if the target value is not present in the list?
A) It returns the position where the target value should be inserted
B) It results in an infinite loop
C) It returns the position of the nearest smaller value
D) It returns -1 or an error indicating that the value is not found
44. What Is the primary advantage of binary search over linear search?
A) It requires less memory B) It is simpler to implement C) It has a lower time complexity for large, sorted lists
D) It works on unsorted lists
45. Which search algorithm compares each element sequentially until the target value is found?
A) Binary search B) Linear search C) Jump search D) Exponential search

Key:
1 B 2 D 3 B 4 C 5 D 6 D 7 C 8 D 9 C 10 B

11 C 12 B 13 C 14 C 15 B 16 C 17 B 18 C 19 D 20 C

21 B 22 C 23 C 24 C 25 B 26 C 27 B 28 D 29 B 30 C

31 C 32 B 33 C 34 C 35 C 36 B 37 A 38 B 39 B 40 C

41 B 42 B 43 D 44 C 45 B

You might also like