Grade 12 Computer Science and Programming Practice Tests

These Grade 12 Computer Science and Programming practice tests build foundations in coding, algorithms, data structures, databases, web development, cybersecurity, artificial intelligence, testing, and responsible technology use.

Skills covered

  • Programming foundations: variables, conditionals, loops, functions, arrays, Boolean values, tracing, syntax errors, pseudocode, and input validation
  • Algorithms and data structures: binary representation, algorithms, complexity, recursion, stacks, queues, sorting, searching, abstraction, and modularity
  • Data and security: tables, primary keys, SQL retrieval, encryption, authentication, authorization, phishing, backups, sanitization, and data minimization
  • Web and software development: HTML, CSS, APIs, client-server systems, version control, unit testing, documentation, accessibility, responsive design, and deployment
  • Computational thinking and AI: training data, algorithmic bias, ethics, debugging, decomposition, pattern recognition, trade-offs, open source, and project reflection

How to use these practice tests

Trace each step carefully, define the data or system concept, and consider what the program or technology should do under the stated conditions. When questions involve real users, include security, accessibility, privacy, and ethical effects in your reasoning.

For more Grade 12 preparation, return to the College and Career Preparation category.

1. Test

Grade 12 Computer Science and Programming Practice Tests

Practice Grade 12 Computer Science and Programming questions about code, algorithms, data structures, databases, web development, security, artificial intelligence, and software projects.

Choose the best answer. Trace the logic, identify the system or data concept, and consider reliability, security, accessibility, and ethical effects where relevant.

10 Questions
0/10 Questions0 %
Correct 0
Incorrect 0
Unanswered 10
1. QuestionMultiple choice

What is a variable in a program?

Please select an answer first.

Correct answer: A

The correct answer is A named location or reference used to store a value that can be used by the program.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: Variables let programs represent and update data while a program runs.
  3. Check the result: The correct answer is A named location or reference used to store a value that can be used by the program.

Variables let programs represent and update data while a program runs.

2. QuestionMultiple choice

What is the purpose of a conditional statement?

Please select an answer first.

Correct answer: B

The correct answer is To choose which instructions run based on whether a condition is true or false.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: Conditionals let a program branch so different actions occur for different inputs or states.
  3. Check the result: The correct answer is To choose which instructions run based on whether a condition is true or false.

Conditionals let a program branch so different actions occur for different inputs or states.

3. QuestionMultiple choice

What does a loop do?

Please select an answer first.

Correct answer: C

The correct answer is Repeats a block of instructions while a stated condition or iteration rule applies.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: Loops reduce repeated code and continue according to a condition, count, or collection of values.
  3. Check the result: The correct answer is Repeats a block of instructions while a stated condition or iteration rule applies.

Loops reduce repeated code and continue according to a condition, count, or collection of values.

4. QuestionMultiple choice

What is a function?

Please select an answer first.

Correct answer: D

The correct answer is A named, reusable block of code that can accept inputs and produce an output or effect.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: Functions organize programs into reusable units and can make code easier to test and understand.
  3. Check the result: The correct answer is A named, reusable block of code that can accept inputs and produce an output or effect.

Functions organize programs into reusable units and can make code easier to test and understand.

5. QuestionMultiple choice

In a zero-indexed array, what is the index of the first element?

Please select an answer first.

Correct answer: A

The correct answer is 0.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: Zero-indexed arrays assign index 0 to the first element, index 1 to the second, and so on.
  3. Check the result: The correct answer is 0.

Zero-indexed arrays assign index 0 to the first element, index 1 to the second, and so on.

6. QuestionMultiple choice

Which value is Boolean?

Please select an answer first.

Correct answer: B

The correct answer is true.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: Boolean data has two logical values, commonly represented as true and false.
  3. Check the result: The correct answer is true.

Boolean data has two logical values, commonly represented as true and false.

7. QuestionMultiple choice

What is the value of x after this sequence? x = 4; x = x + 3;

Please select an answer first.

Correct answer: C

The correct answer is 7.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: The second statement uses the current value 4 and assigns the result of 4 plus 3, which is 7.
  3. Check the result: The correct answer is 7.

The second statement uses the current value 4 and assigns the result of 4 plus 3, which is 7.

8. QuestionMultiple choice

What is a syntax error?

Please select an answer first.

Correct answer: D

The correct answer is An error caused by code that does not follow the language’s required grammar or structure.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: Syntax errors prevent code from being parsed or executed correctly because the written structure is invalid.
  3. Check the result: The correct answer is An error caused by code that does not follow the language’s required grammar or structure.

Syntax errors prevent code from being parsed or executed correctly because the written structure is invalid.

9. QuestionMultiple choice

What is pseudocode used for?

Please select an answer first.

Correct answer: A

The correct answer is Planning an algorithm in readable steps without committing to one programming language.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: Pseudocode focuses on logic and sequence so a solution can be discussed before implementation details are chosen.
  3. Check the result: The correct answer is Planning an algorithm in readable steps without committing to one programming language.

Pseudocode focuses on logic and sequence so a solution can be discussed before implementation details are chosen.

10. QuestionMultiple choice

Why should a program validate user input?

Please select an answer first.

Correct answer: B

The correct answer is To check that input is safe, expected, and usable before the program processes it.

  1. Identify the computer science concept: Determine whether the question concerns programming, algorithms, data structures, systems, web development, security, data, artificial intelligence, or ethics.
  2. Trace the logic or principle: Validation can detect missing, invalid, out-of-range, or unsafe input and help the program respond appropriately.
  3. Check the result: The correct answer is To check that input is safe, expected, and usable before the program processes it.

Validation can detect missing, invalid, out-of-range, or unsafe input and help the program respond appropriately.

Previous testNext test