Computing and Information Technology

Programming with C and C++ Practice Exam, Flashcards & Questions

Master foundational to advanced Programming with C and C++ with 359 verified curriculum items, worked engineering solutions, and spaced-repetition cards.

269 Total Questions 86 MCQs 105 Calculations 78 Flashcards
Free Interactive Preview

Programming with C and C++ Sample Exam Questions & Rationale

Preview official questions below. The complete pool of 269 items is available in the offline app.

Question 1 of 4 Arrays and strings

In standard C, which byte value terminates every valid null-terminated string literal in memory?

A '\0' (ASCII 0)
B '\n' (ASCII 10)
C ' ' (ASCII 32)
D EOF (-1)
Accepted Answer: Option A ('\0' (ASCII 0))

Rationale: C strings are null-terminated arrays of characters terminated by the null byte '\0', whose integer value is exactly zero.

Question 2 of 4 Compilation process

Which stage of the standard C build process removes comments, expands `#define` macros, and processes `#include` directives?

A Linking
B Assembly
C Preprocessing
D Compilation
Accepted Answer: Option C (Preprocessing)

Rationale: The preprocessor runs first, transforming source code into preprocessed pure C code by expanding macros, including files, and evaluating conditional directives.

Question 3 of 4 Control structures

In a C `switch` statement, what occurs if a matching `case` block does not end with a `break` or `return` statement?

A The compiler generates a mandatory syntax error
B Execution falls through unconditionally into the subsequent case or default statement
C The switch statement terminates immediately
D Execution restarts from the first case label
Accepted Answer: Option B (Execution falls through unconditionally into the subsequent case or default statement)

Rationale: Without a break statement, control flows directly into subsequent case blocks (case fallthrough), executing statements until a break or the end of the switch is reached.

Question 4 of 4 Data types and sizes

Under the C99 and C11 standards, which format specifier is specifically designated for printing values of type `size_t` via `printf`?

A %u
B %ld
C %zu
D %lu
Accepted Answer: Option C (%zu)

Rationale: The C99 standard introduced the 'z' length modifier specifically for size_t, making '%zu' the portable format specifier for printing size_t values.

Active Recall Spaced Repetition Cards (Preview)

Card 1 • Arrays and strings
When an array expression appears in most expressions, it decays into a {{c1::pointer}} to its first element.
Array decay converts array type T[N] into pointer type T* pointing to index 0, which is why arrays cannot be passed by value to functions.
Card 2 • Compilation process
The {{c1::assembler}} translates human-readable assembly instructions into relocatable machine object code.
The compilation stage turns C into assembly, the assembler converts assembly into object code (.o/.obj), and the linker binds object files into an executable.

Programming with C and C++ Curriculum Modules & Topics Covered

Modules
C BasicsPointers and MemoryC++ and Object-Oriented ProgrammingSystems and Embedded Programming
Core Exam Topics
  • Data types and sizes
  • Operators and precedence
  • Control structures
  • Functions and prototypes
  • Arrays and strings
  • Preprocessor and macros
  • Compilation process
  • Header files
  • Pointers and addresses
  • Pointer arithmetic
Learning Objectives
  • Develop core conceptual recall and analytical problem-solving in C Basics.
  • Develop core conceptual recall and analytical problem-solving in Pointers and Memory.
  • Develop core conceptual recall and analytical problem-solving in C++ and Object-Oriented Programming.
  • Develop core conceptual recall and analytical problem-solving in Systems and Embedded Programming.

Free Downloadable Programming with C and C++ Study Packs (.ZIP / .TSV)

Full Spreadsheet Data (TSV)
TSV • 269 items
Complete Course Pack
ZIP • 269 items
Elements (Complete)
ZIP • 269 items
Elements (Mastery)
ZIP • 269 items
Elements (Standard)
ZIP • 269 items
Active Recall Flashcards
ZIP • 269 items
Formula Codex
ZIP • 269 items
Problem Solving (Mastery)
ZIP • 269 items
Artificial Intelligence (1,579) Artificial Intelligence and Machine Learning (507) Cloud Computing and DevOps (144) Compiler Design & Formal Languages (1,579) Computational Contact Mechanics: Penalty Function Method, Lagrange Multipliers & Mortar Contact Formulations (128) Computer Engineering & Algorithms (1,365)
Full Question Pool: 269 Verified Items

Unlock All 269 Programming with C and C++ Practice Questions

Study the full question pool with 13 active recall battle modes, FSRS v5 spaced repetition, and 1-click printable PDF mock exams with full answer keys on Android and Windows PC.

Get on Google Play (Android) Get on Microsoft Store (Windows PC)