





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















1. What is a programming language?
A. A formal language used to communicate instructions to a computer B. A type of computer hardware C. A database management system D. A network protocol
Correct Answer: A
Rationale: Programming languages provide structured rules and syntax for writing software instructions.
2. Which generation of programming languages is considered machine language?
A. First Generation (1GL) B. Second Generation (2GL) C. Third Generation (3GL) D. Fourth Generation (4GL)
Correct Answer: A
Rationale: Machine language consists of binary instructions directly understood by the computer.
3. Assembly language is classified as:
A. Second Generation Language (2GL) B. First Generation Language (1GL) C. Third Generation Language (3GL) D. Fifth Generation Language (5GL)
Correct Answer: A
Rationale: Assembly language uses mnemonic codes to represent machine instructions.
4. Which of the following is a high-level programming language?
A. Java B. Binary C. Machine Code D. Assembly Opcode
Correct Answer: A
Rationale: High-level languages are easier for humans to read and write.
5. What is the primary advantage of high-level languages?
A. Improved readability and portability B. Direct execution by hardware only C. No need for translation D. Faster hardware manufacturing
Correct Answer: A
Rationale: High-level languages simplify software development and maintenance.
6. A compiler translates:
A. Entire source code into machine code before execution B. One line at a time during execution C. Hardware instructions into software D. Databases into source code
Correct Answer: A
Rationale: Compilers create executable programs before runtime.
7. An interpreter differs from a compiler because it:
A. Translates and executes code line by line B. Produces executable files before execution
A. Code violates language grammar rules B. Logic produces incorrect output C. Hardware fails D. A database is unavailable
Correct Answer: A
Rationale: Syntax errors prevent successful compilation or interpretation.
12. A logic error occurs when:
A. The program runs but produces incorrect results B. Code cannot compile C. Hardware stops functioning D. A file is missing
Correct Answer: A
Rationale: Logic errors affect program correctness rather than execution.
13. What is a variable?
A. A named storage location for data B. A programming language keyword only C. A database table D. A compiler component
Correct Answer: A
Rationale: Variables store information used during program execution.
14. Which data type stores whole numbers?
A. Integer B. Float C. String D. Boolean
Correct Answer: A
Rationale: Integers represent whole-number values.
15. Which data type stores decimal values?
A. Float B. Integer C. String D. Character
Correct Answer: A
Rationale: Floating-point types store fractional numbers.
16. A string is used to store:
A. Text data B. Whole numbers only C. Decimal numbers only D. Boolean values only
Correct Answer: A
Rationale: Strings represent sequences of characters.
17. Boolean values are typically:
A. True or False B. Positive or Negative C. Integer or Float D. Character or String
Correct Answer: A
Rationale: Boolean data types represent logical conditions.
18. Which operator is commonly used for assignment?
A. = B. == C. != D. >=
Correct Answer: A
Rationale: Assignment operators store values in variables.
Rationale: else executes when preceding conditions are not met.
23. A loop is used to:
A. Repeat a block of code B. Define variables C. Create classes D. Compile programs
Correct Answer: A
Rationale: Loops automate repetitive tasks.
24. Which loop is commonly used when the number of iterations is known?
A. for loop B. while loop C. do loop D. switch loop
Correct Answer: A
Rationale: For loops efficiently process known sequences.
25. A while loop continues until:
A. Its condition becomes false B. The computer shuts down C. A variable is created D. The source code changes
Correct Answer: A
Rationale: While loops depend on logical conditions.
26. What is a function?
A. A reusable block of code B. A hardware component C. A database record D. A compiler error
Correct Answer: A
Rationale: Functions organize logic and reduce duplication.
27. Why are functions useful?
A. They promote code reuse and modularity B. They eliminate variables C. They prevent all bugs D. They replace loops
Correct Answer: A
Rationale: Functions improve maintainability and readability.
28. What is a parameter?
A. A value passed into a function B. A loop condition C. A file type D. A compiler option
Correct Answer: A
Rationale: Parameters allow functions to receive input data.
29. What does a return statement do?
A. Sends a value back from a function B. Ends the operating system C. Deletes variables D. Creates a loop
Correct Answer: A
Rationale: Return statements provide results to calling code.
30. What is recursion?
A. A function calling itself B. A compiler optimization
A. Bundling data and methods together B. Eliminating classes C. Avoiding variables D. Removing functions
Correct Answer: A
Rationale: Encapsulation promotes security and organization.
35. Inheritance allows classes to:
A. Reuse properties and methods from other classes B. Eliminate functions C. Remove variables D. Avoid testing
Correct Answer: A
Rationale: Inheritance improves code reuse and maintainability.
36. Polymorphism enables:
A. Different implementations through a common interface B. Faster hardware execution C. Elimination of classes D. Removal of objects
Correct Answer: A
Rationale: Polymorphism increases software flexibility.
37. Abstraction focuses on:
A. Hiding implementation complexity B. Eliminating variables C. Replacing classes D. Increasing memory usage
Correct Answer: A
Rationale: Abstraction exposes only essential information.
38. Which language is strongly associated with object-oriented programming?
A. Java B. Assembly C. Machine Language D. Binary Code
Correct Answer: A
Rationale: Java was designed around object-oriented principles.
39. What is a programming paradigm?
A. A style or approach to programming B. A hardware architecture C. A network protocol D. A database structure
Correct Answer: A
Rationale: Paradigms define programming philosophies and techniques.
40. Procedural programming organizes code around:
A. Procedures and functions B. Objects and classes C. Databases and files D. Networks and devices
Correct Answer: A
Rationale: Procedural programming emphasizes sequential execution and functions.
41. Functional programming emphasizes:
A. Functions and immutability B. Hardware optimization C. Database administration D. Operating system design
Correct Answer: A
Rationale: Functional programming treats computation as function evaluation.
Rationale: Source code is written by programmers before translation.
46. Machine code consists primarily of:
A. Binary instructions B. English words C. Database queries D. Graphical symbols
Correct Answer: A
Rationale: Computers execute binary machine instructions directly.
47. What is debugging?
A. Identifying and correcting program errors B. Creating classes C. Installing hardware D. Writing documentation only
Correct Answer: A
Rationale: Debugging improves software correctness and quality.
48. Software testing helps:
A. Verify program functionality and identify defects B. Replace source code C. Eliminate documentation D. Prevent compilation
Correct Answer: A
Rationale: Testing ensures software behaves as expected.
49. Why is readability important in programming languages?
A. It improves understanding and maintenance B. It increases processor speed C. It eliminates errors completely D. It reduces memory usage automatically
Correct Answer: A
Rationale: Readable code is easier to maintain and modify.
50. The primary goal of programming languages is to:
A. Enable developers to create software solutions efficiently B. Replace computer hardware C. Eliminate operating systems D. Prevent software maintenance
Correct Answer: A
Rationale: Programming languages provide tools for solving problems through software development.
51. What is type checking in programming languages?
A. Verifying that operations use compatible data types B. Testing network connectivity C. Compiling source code only D. Creating databases
Correct Answer: A
Rationale: Type checking helps prevent errors caused by incompatible data operations.
52. A statically typed language performs most type checking:
A. Before program execution B. After deployment C. During hardware installation D. Only when errors occur
Correct Answer: A
Rationale: Static typing checks types at compile time.
53. Which language is statically typed?
A. Java B. Python C. JavaScript D. PHP
C. Function D. Class
Correct Answer: A
Rationale: Arrays store items in indexed positions.
58. A stack follows which principle?
A. Last In, First Out (LIFO) B. First In, First Out (FIFO) C. Random Access D. Sequential Execution Only
Correct Answer: A
Rationale: The most recently added item is removed first.
59. A queue follows which principle?
A. First In, First Out (FIFO) B. Last In, First Out (LIFO) C. Reverse Access D. Recursive Processing
Correct Answer: A
Rationale: The earliest inserted item is processed first.
60. Which data structure stores key-value pairs?
A. Dictionary B. Array C. Stack D. Queue
Correct Answer: A
Rationale: Dictionaries allow efficient lookup using keys.
61. What is memory management?
A. Allocating and releasing memory resources B. Designing user interfaces C. Creating documentation D. Managing network devices
Correct Answer: A
Rationale: Efficient memory management improves application performance.
62. Garbage collection is used to:
A. Automatically reclaim unused memory B. Remove syntax errors C. Create variables D. Improve network performance
Correct Answer: A
Rationale: Garbage collection prevents memory leaks by freeing unused objects.
63. Which language is known for automatic garbage collection?
A. Java B. Assembly C. C D. Pascal
Correct Answer: A
Rationale: Java automatically manages memory through garbage collection.
64. What is a memory leak?
A. Memory that is allocated but never released B. A network failure C. A syntax error D. A compiler warning
Correct Answer: A
Rationale: Memory leaks can reduce performance and cause crashes.
69. What is exception handling?
A. Managing runtime errors gracefully B. Creating classes C. Building databases D. Installing operating systems
Correct Answer: A
Rationale: Exception handling improves reliability and user experience.
70. Which construct is commonly used for exception handling?
A. try-catch / try-except B. while C. switch D. loop
Correct Answer: A
Rationale: These constructs capture and handle errors during execution.
71. What is a library in programming?
A. A collection of reusable code B. A hardware component C. A database table D. A network device
Correct Answer: A
Rationale: Libraries provide prewritten functionality for developers.
72. Why are libraries important?
A. They reduce development time and effort B. They eliminate all bugs C. They replace source code D. They remove the need for testing
Correct Answer: A
Rationale: Libraries allow developers to reuse existing solutions.
73. An API provides:
A. A mechanism for software communication B. Hardware instructions only C. Operating system updates D. Database backups
Correct Answer: A
Rationale: APIs define how applications interact with one another.
74. What is modular programming?
A. Dividing software into smaller components B. Writing all code in one file C. Eliminating functions D. Avoiding documentation
Correct Answer: A
Rationale: Modular design improves maintainability and reuse.
75. What is software portability?
A. Ability to run on different systems B. Ability to create variables C. Ability to eliminate bugs D. Ability to increase processor speed
Correct Answer: A
Rationale: Portable programs require minimal changes across platforms.
76. Which language feature improves code readability?
A. Meaningful variable names B. Random identifiers C. Removing comments D. Long nested conditions everywhere