Docsity

Computer Science Practice Exam: Key Concepts and Problem Solving, Exams of Technology

Toggle sidebar
bg1
CE181CEOE Computer Science Practice Exam
**Question 1.** Which of the following best describes the principle of
**abstraction** in problem solving?
A) Dividing a problem into smaller parts
B) Ignoring irrelevant details and focusing on essential features
C) Reusing code through functions
D) Executing a program step‑by‑step
**Answer:** B
**Explanation:** Abstraction involves identifying the core aspects of a problem
while discarding details that do not affect the solution.
**Question 2.** In decomposition, a complex problem is:
A) Solved with a single loop
B) Broken into independent sub‑problems
C) Converted to binary code
D) Optimized for memory usage
**Answer:** B
**Explanation:** Decomposition means splitting a large problem into smaller,
manageable pieces that can be solved separately.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Computer Science Practice Exam: Key Concepts and Problem Solving and more Exams Technology in PDF only on Docsity!

Question 1. Which of the following best describes the principle of abstraction in problem solving? A) Dividing a problem into smaller parts B) Ignoring irrelevant details and focusing on essential features C) Reusing code through functions D) Executing a program step‑by‑step Answer: B Explanation: Abstraction involves identifying the core aspects of a problem while discarding details that do not affect the solution. Question 2. In decomposition, a complex problem is: A) Solved with a single loop B) Broken into independent sub‑problems C) Converted to binary code D) Optimized for memory usage Answer: B Explanation: Decomposition means splitting a large problem into smaller, manageable pieces that can be solved separately.

Question 3. Which technique helps recognize similarities among different problems to aid solution design? A) Encapsulation B) Pattern recognition C) Recursion D) Polymorphism Answer: B Explanation: Pattern recognition identifies common structures or patterns across problems, facilitating reuse of solutions. Question 4. A module in programming typically refers to: A) A hardware component B) A reusable function or procedure C) A data type D) An operating system kernel Answer: B Explanation: Modularization creates separate functions or procedures that can be reused, improving clarity and maintainability.

Question 7. The worst‑case number of comparisons performed by selection sort on an array of n elements is: A) n – 1 B) n(n – 1)/ C) n log n D) 2ⁿ Answer: B Explanation: Selection sort makes (n‑1) + (n‑2) + … + 1 = n(n‑1)/ comparisons. Question 8. In quick sort, the choice of pivot affects performance. Which pivot strategy guarantees O(n log n) average time? A) Always choose the first element B) Always choose the last element C) Choose a random element D) Choose the median of three Answer: C Explanation: Random pivot selection avoids consistently bad partitions, yielding expected O(n log n) performance.

Question 9. Which control structure repeats a block at least once before testing its condition? A) for loop B) while loop C) do‑while loop D) if‑else statement Answer: C Explanation: A do‑while loop executes the body first, then checks the condition. Question 10. Which primitive data type typically occupies 4 bytes in most modern languages? A) char B) boolean C) int D) double Answer: C Explanation: An int is commonly 32 bits (4 bytes) on mainstream architectures.

A) enqueue B) push C) pop D) insert Answer: B Explanation: push places a new element onto the top of a LIFO stack. Question 14. Which data structure follows First‑In‑First‑Out (FIFO) order? A) Stack B) Queue C) Tree D) Hash table Answer: B Explanation: Queues remove elements in the same order they were added. Question 15. A singly linked list differs from an array because: A) It provides constant‑time random access. B) Its elements are stored contiguously in memory.

C) Insertion at the front is O(1). D) It cannot grow dynamically. Answer: C Explanation: Adding a node at the head of a singly linked list only changes a couple of pointers, taking O(1) time. Question 16. In a binary search tree (BST), which property holds for every node? A) All left‑subtree keys are greater than the node’s key. B) All right‑subtree keys are smaller than the node’s key. C) Left keys ≤ node key ≤ right keys. D) The tree is always balanced. Answer: C Explanation: BSTs maintain the ordering invariant: left children ≤ node ≤ right children. Question 17. Which tree traversal visits nodes in root‑left‑right order? A) In‑order B) Pre‑order C) Post‑order

Explanation: BFS explores vertices level by level, employing a FIFO queue. Question 20. In a hash table using separate chaining, collisions are resolved by: A) Linear probing B. Quadratic probing C. Storing colliding elements in a linked list at the same bucket D. Re‑hashing with a new function Answer: C Explanation: Separate chaining keeps a list of entries for each bucket where collisions occur. Question 21. Which OOP principle emphasizes hiding internal state and exposing only needed operations? A) Inheritance B) Polymorphism C) Encapsulation D) Abstraction Answer: C

Explanation: Encapsulation bundles data and methods, restricting direct access to internal representation. Question 22. A subclass that inherits behavior from a superclass is an example of: A) Polymorphism B) Encapsulation C) Inheritance D) Overloading Answer: C Explanation: Inheritance allows a subclass to acquire attributes and methods of its parent class. Question 23. Method overriding is a form of which OOP concept? A) Encapsulation B) Polymorphism C) Inheritance D) Composition Answer: B

Explanation: The CPU repeatedly fetches an instruction, decodes it, and executes it. Question 26. Which number system uses base 16? A) Binary B) Octal C) Decimal D) Hexadecimal Answer: D Explanation: Hexadecimal employs sixteen symbols (0‑9, A‑F). Question 27. In two’s complement representation, the binary pattern 1111 1111 (8‑bit) represents: A) + B) – 1 C) + D) – 128 Answer: B Explanation: In two’s complement, the most significant bit indicates sign; 1111 1111 corresponds to – 1.

Question 28. Which component of a computer temporarily holds data that the CPU is actively using? A) Hard disk B) ROM C) RAM D) SSD Answer: C Explanation: RAM (Random‑Access Memory) provides fast, volatile storage for active data. Question 29. The kernel of an operating system is responsible for: A) Rendering graphics only B) Managing hardware resources and providing core services C) Running user‑level applications exclusively D) Storing user files Answer: B Explanation: The kernel mediates between hardware and software, handling memory, processes, and I/O.

Question 32. The primary purpose of HTTPS over HTTP is: A) Faster page loading B) Data compression C) Encryption of transmitted data D) Use of port 80 Answer: C Explanation: HTTPS adds TLS/SSL encryption, protecting confidentiality and integrity. Question 33. A star topology is characterized by: A) Each node connected to exactly two others forming a ring B) All nodes connected to a central hub or switch C) Nodes connected in a linear bus line D) Every node directly connected to every other node Answer: B Explanation: In a star, each peripheral device links to a central device, simplifying management. Question 34. Which device operates at the network layer and forwards packets based on IP addresses?

A) Switch B) Hub C) Router D) Bridge Answer: C Explanation: Routers examine Layer‑3 (IP) information to route packets between networks. Question 35. Phishing attacks primarily aim to: A) Install ransomware automatically B) Steal user credentials by masquerading as a trustworthy entity C) Overload servers with traffic D) Hijack DNS records Answer: B Explanation: Phishing tricks users into revealing sensitive information under false pretenses. Question 36. Which encryption method uses the same key for both encryption and decryption? A) RSA

C) Intellectual property of software developers D) Government classified information Answer: B Explanation: GDPR sets rules for handling personal data of individuals in the European Union. Question 39. Which of the following is an example of software piracy? A) Using open‑source libraries under their license terms B. Purchasing a legitimate copy of an operating system C. Distributing cracked copies of a commercial game online D. Contributing code to a community project Answer: C Explanation: Unauthorized copying and distribution of copyrighted software constitutes piracy. Question 40. The digital divide refers to: A) The gap between analog and digital devices B) Disparities in access to information technology among different populations C. The difference between binary and decimal representations

D. The separation of hardware and software layers Answer: B Explanation: The digital divide highlights unequal access to computing resources and internet connectivity. Question 41. An algorithm that systematically favors a particular group due to biased training data suffers from: A) Overfitting B) Underflow C) Algorithmic bias D. Deadlock Answer: C Explanation: Algorithmic bias arises when data or design choices produce unfair outcomes. Question 42. In a relational database, a primary key must be: A) Unique and not null for each record B) Duplicate across multiple rows C) A foreign key in another table D. Optional for every table