AP Computer Science A – Unit 1.1 Exam

Introduction to Algorithms, Programming, and Compilers • 25 Questions, Multiple Choice (A–E)
Source: 1.1 Introduction to Algorithms, Programming, and Compilers :contentReference[oaicite:0]{index=0}

  1. What is an algorithm?

    A. A step-by-step process to solve a problem

    B. A physical machine component

    C. A random guess that sometimes works

    D. A type of programming error

    E. A code file generated by a compiler

  2. In everyday life, which example best represents an algorithm?

    A. A recipe for baking a cake

    B. A photograph of the ingredients

    C. A grocery list

    D. The oven temperature display

    E. The kitchen timer

  3. Algorithms must be

    A. Clear, precise, and finite

    B. Confusing and open-ended

    C. Written only in Java

    D. Random and unstructured

    E. Endless and repetitive

  4. In computer science, algorithms are often expressed as

    A. Pseudocode or flowcharts

    B. Musical notes

    C. Handwritten paragraphs

    D. Binary-only code

    E. Spoken instructions

  5. Why is algorithm efficiency important?

    A. It saves time and resources

    B. It adds more lines of code

    C. It makes programs longer

    D. It slows down computation

    E. It increases complexity

  6. What is the first step in finding the largest number in a list?

    A. Assume the first number is the largest

    B. Compare all numbers at once

    C. Sort the list alphabetically

    D. Ignore the first number

    E. Use recursion immediately

  7. What should an algorithm do after comparing two numbers?

    A. Update the largest value if necessary

    B. Restart the program

    C. Delete the smaller number permanently

    D. Ignore the comparison

    E. Multiply both numbers together

  8. What is programming?

    A. Translating an algorithm into code

    B. Writing essays about computers

    C. Drawing computer diagrams

    D. Encrypting passwords

    E. Adjusting monitor settings

  9. Which language is primarily used in AP Computer Science A?

    A. Java

    B. C#

    C. Python

    D. Scratch

    E. Assembly

  10. What is syntax in programming?

    A. The rules that define how code must be written

    B. The computer’s processing speed

    C. The font style of the code editor

    D. The color scheme of the interface

    E. The number of lines in a program

  11. What does logic in programming refer to?

    A. The reasoning behind code behavior

    B. The number of syntax errors

    C. The speed of compilation

    D. The appearance of the IDE

    E. The order of error messages

  12. What is debugging?

    A. Finding and fixing errors in code

    B. Writing untested code

    C. Deleting working programs

    D. Ignoring compiler warnings

    E. Running code without reviewing it

  13. What is the purpose of problem solving in programming?

    A. Designing programs to achieve a goal

    B. Memorizing syntax rules

    C. Avoiding compilation

    D. Copying existing solutions

    E. Writing the longest code possible

  14. What does the Java compiler do?

    A. Converts human code into bytecode

    B. Draws flowcharts

    C. Translates bytecode back into English

    D. Designs the user interface

    E. Compresses program files

  15. What is the extension of a Java source code file?

    A. .java

    B. .class

    C. .exe

    D. .doc

    E. .txt

  16. What does the .class file contain?

    A. Bytecode ready to be executed by the JVM

    B. The original Java source code

    C. The pseudocode version of the algorithm

    D. Debug logs from testing

    E. Comments removed by the compiler

  17. What tool executes Java bytecode on a computer?

    A. Java Virtual Machine (JVM)

    B. Text editor

    C. Web browser

    D. Terminal window

    E. Database

  18. Why is Java considered portable?

    A. Bytecode can run on any system with a JVM

    B. It only runs on Windows

    C. It must be rewritten for every platform

    D. It requires special hardware

    E. It uses handwritten machine code

  19. What does a compiler help identify?

    A. Syntax errors

    B. Grammar issues in English

    C. Hardware damage

    D. Network latency

    E. Logic flaws in planning

  20. What is the main goal of a compiler?

    A. Ensure code runs efficiently and correctly

    B. Randomly rearrange the code

    C. Translate binary to English

    D. Make the program look shorter

    E. Eliminate all comments

  21. What is the relationship among algorithm, program, and compiler?

    A. Algorithm → Program → Compiler → Execution

    B. Compiler → Program → Algorithm → Execution

    C. Program → Algorithm → Compiler → Execution

    D. Execution → Algorithm → Compiler → Program

    E. Algorithm → Compiler → Program → Execution

  22. Which of the following best describes pseudocode?

    A. A way to represent algorithms using plain English

    B. A fully working Java program

    C. A debugging tool

    D. A code editor feature

    E. A machine language output

  23. Which is the correct order for coding in Java?

    A. Write code → Compile → Run

    B. Compile → Write code → Debug

    C. Debug → Compile → Write code

    D. Run → Compile → Write code

    E. Plan → Run → Rewrite

  24. What happens when the compiler detects a syntax error?

    A. It stops the program and shows an error message

    B. It ignores the mistake and runs anyway

    C. It automatically fixes the issue

    D. It deletes the code file

    E. It shuts down the computer

  25. In AP Computer Science A, students learn to

    A. Design algorithms, write Java code, and compile programs

    B. Memorize textbook pages

    C. Avoid debugging

    D. Focus only on hardware setup

    E. Skip the compilation process