CCP Programming Concepts & Application Development 3 — Questions and Answers
Question 1: What does the term 'coupling' refer to in software design?
- The number of methods in a class
- The degree of interdependence between software modules (Correct answer)
- The process of linking libraries to an executable
- The speed at which modules communicate
Correct answer: The degree of interdependence between software modules
Coupling refers to how much one module depends on another; low coupling is preferred for maintainable, modular designs.
Question 2: Which data structure operates on a Last-In, First-Out (LIFO) principle?
- Queue
- Linked List
- Stack (Correct answer)
- Heap
Correct answer: Stack
A stack follows LIFO — the last element pushed onto the stack is the first one to be popped off.
Question 3: In version control with Git, what does a 'merge conflict' indicate?
- Two branches have identical files
- Two branches have incompatible changes to the same file region (Correct answer)
- A branch has been deleted remotely
- The remote repository is out of sync with the local clone
Correct answer: Two branches have incompatible changes to the same file region
A merge conflict occurs when Git cannot automatically reconcile differences because two branches changed the same part of a file differently.
Question 4: What is the purpose of a 'garbage collector' in programming languages like Java or C#?
- To delete unused source code files
- To automatically reclaim memory occupied by objects no longer in use (Correct answer)
- To clean up temporary files on disk
- To remove duplicate entries from a database
Correct answer: To automatically reclaim memory occupied by objects no longer in use
A garbage collector automatically manages memory by identifying and freeing memory that is no longer referenced by the program.
Question 5: Which principle of software design states that a class should have only one reason to change?
- Open/Closed Principle
- Liskov Substitution Principle
- Single Responsibility Principle (Correct answer)
- Dependency Inversion Principle
Correct answer: Single Responsibility Principle
The Single Responsibility Principle (SRP) states that a class should have only one job or reason to change, promoting cohesion.
Question 6: In software testing, what is 'unit testing'?
- Testing the entire application as a whole
- Testing individual components or functions in isolation (Correct answer)
- Testing the interaction between integrated modules
- Testing the system against user requirements
Correct answer: Testing individual components or functions in isolation
Unit testing validates individual functions or components in isolation to ensure each unit works correctly on its own.
Question 7: What does 'refactoring' mean in software development?
- Rewriting an application from scratch in a new language
- Restructuring existing code without changing its external behavior (Correct answer)
- Adding new features to existing software
- Converting code from one paradigm to another
Correct answer: Restructuring existing code without changing its external behavior
Refactoring improves code structure, readability, and maintainability while preserving its observable behavior.
What does the term 'coupling' refer to in software design?