MS Master of Computer Science 3 — Questions and Answers
Question 1: Which machine learning technique uses labeled training data to learn a mapping from inputs to outputs?
- Unsupervised learning
- Reinforcement learning
- Supervised learning (Correct answer)
- Self-supervised learning
Correct answer: Supervised learning
Supervised learning trains a model on input-output pairs so it can predict outputs for new, unseen inputs.
Question 2: What is the role of a compiler's semantic analysis phase?
- Converting source code to machine code
- Checking type correctness and scope rules (Correct answer)
- Optimizing memory layout
- Parsing tokens into a syntax tree
Correct answer: Checking type correctness and scope rules
Semantic analysis verifies that a syntactically correct program is also meaningful, checking types, scopes, and declarations.
Question 3: In operating systems, what is thrashing?
- CPU overheating under heavy load
- Excessive paging where the system spends more time swapping than executing (Correct answer)
- A deadlock involving all processes
- Memory fragmentation in the heap
Correct answer: Excessive paging where the system spends more time swapping than executing
Thrashing occurs when a system has insufficient physical memory, causing constant page faults and near-zero useful CPU utilization.
Question 4: Which cryptographic primitive provides both data integrity and authentication using a shared secret key?
- Digital signature
- HMAC (Correct answer)
- Public-key encryption
- Hash function alone
Correct answer: HMAC
HMAC (Hash-based Message Authentication Code) combines a cryptographic hash with a shared secret to provide integrity and authentication.
Question 5: What does Big-O notation describe about an algorithm?
- Exact execution time in milliseconds
- Space usage only
- Asymptotic upper bound on growth rate of resource usage (Correct answer)
- Best-case performance
Correct answer: Asymptotic upper bound on growth rate of resource usage
Big-O describes the upper bound on how an algorithm's time or space requirements grow relative to input size as n approaches infinity.
Question 6: Which graph algorithm finds the shortest path from a single source to all other vertices in a weighted graph with non-negative edges?
- Bellman-Ford
- Floyd-Warshall
- Dijkstra's algorithm (Correct answer)
- Prim's algorithm
Correct answer: Dijkstra's algorithm
Dijkstra's algorithm uses a greedy approach with a priority queue to find shortest paths from one source, requiring non-negative edge weights.
Question 7: In object-oriented design, what does the Liskov Substitution Principle (LSP) state?
- A class should have only one reason to change
- Objects of a subclass must be replaceable for objects of the superclass without breaking correctness (Correct answer)
- Depend on abstractions, not concrete implementations
- Classes should be open for extension but closed for modification
Correct answer: Objects of a subclass must be replaceable for objects of the superclass without breaking correctness
LSP requires that subclasses honor the behavioral contract of their superclass so they can substitute without altering program correctness.
Which machine learning technique uses labeled training data to learn a mapping from inputs to outputs?