OpenExamsFREE PRACTICE — ANY EXAM

Free CLA – C Certified Associate Programmer Practice Questions

100 free questions · Answer explanations · No signup required

View examination details, outline and sources

Loading selected examination banks…

Sample Practice Questions

Try these 10 sample questions from the CLA – C Certified Associate Programmer practice bank. Each includes the answer and explanation. Continue with the interactive practice above to review the full question set.

  1. 1What makes a declaration of a C object a definition?

    1. A. It reserves storage for the object.
    2. B. It mentions the object in an expression.
    3. C. It introduces a name without any type.
    4. D. It makes the object visible in every file.

    Answer: A

    Explanation: "for an object, causes storage to be reserved for that object;" A definition is a declaration that reserves storage. Merely using a name does not define it; declarations specify types, and a definition does not automatically grant visibility in other files.

    Reference: WG14 N1570 — Programming languages — C — 6.7 paragraph 5

  2. 2What value does `17 / 5` produce when both operands have type int?

    1. A. 3.4
    2. B. 4
    3. C. 3
    4. D. 2

    Answer: C

    Explanation: "When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded." Integer division discards the fractional part, so the result is 3. It does not round to 4 or preserve 0.4.

    Reference: WG14 N1570 — Programming languages — C — 6.5.5 paragraph 6

  3. 3Which value is assigned to x when this negative condition is tested: `int x = 0; if (-3) x = 8; else x = 2;`?

    1. A. 0
    2. B. 2
    3. C. 8
    4. D. -3

    Answer: C

    Explanation: "the first substatement is executed if the expression compares unequal to 0." -3 is nonzero, so the first branch stores 8. A condition need not equal positive one to be treated as true.

    Reference: WG14 N1570 — Programming languages — C — 6.8.4.1 paragraph 2

  4. 4Which directive requests inclusion of the standard input/output header in a C translation unit?

    1. A. #define stdio.h
    2. B. #include <stdio.h>
    3. C. #ifdef stdio.h
    4. D. #undef stdio.h

    Answer: B

    Explanation: "causes the replacement of that directive by the entire contents of the header." #include <stdio.h> includes the standard I/O header. #define creates a macro, #ifdef tests a macro name, and #undef removes a macro definition rather than including a header.

    Reference: WG14 N1570 — Programming languages — C — 6.10.2 paragraph 2; 7.21.6.3 synopsis

  5. 5At file scope, how is `extern int total = 7;` classified?

    1. A. A declaration that cannot allocate storage
    2. B. An external definition of the object
    3. C. A function prototype returning an integer
    4. D. A tentative definition without initialization

    Answer: B

    Explanation: "If the declaration of an identifier for an object has file scope and an initializer, the declaration is an external definition for the identifier." The file-scope initializer makes this an external definition, even though extern appears. It is neither a function declaration nor a tentative definition.

    Reference: WG14 N1570 — Programming languages — C — 6.9.2 paragraph 1

  6. 6What is the value of the integer expression `17 % 5`?

    1. A. 3
    2. B. 5
    3. C. 0
    4. D. 2

    Answer: D

    Explanation: "the result of the % operator is the remainder." 17 equals 3 × 5 + 2, so the remainder is 2. The quotient, divisor, and an assumed exact division are incorrect alternatives.

    Reference: WG14 N1570 — Programming languages — C — 6.5.5 paragraph 5

  7. 7These nested if statements have no braces: `int x = 0; if (1) if (0) x = 4; else x = 7;`. What final value of x follows C's else-association rule?

    1. A. 0
    2. B. 4
    3. C. 1
    4. D. 7

    Answer: D

    Explanation: "An else is associated with the lexically nearest preceding if that is allowed by the syntax." The else belongs to the inner if. The outer condition is true and the inner condition is false, so the else stores 7.

    Reference: WG14 N1570 — Programming languages — C — Printed page 149, if statement, paragraph 3

  8. 8After `#define LIMIT 20`, which directive removes LIMIT's macro definition for subsequent preprocessing?

    1. A. #define LIMIT 0
    2. B. #ifdef LIMIT
    3. C. #undef LIMIT
    4. D. #include LIMIT

    Answer: C

    Explanation: "causes the specified identifier no longer to be defined as a macro name." #undef LIMIT removes the definition. Redefining a value, testing the name, or attempting file inclusion does not perform that operation.

    Reference: WG14 N1570 — Programming languages — C — 6.10.3.5 paragraph 2

  9. 9In one scope, `extern int count;` has already declared an object. Which additional declaration gives that same object a compatible type?

    1. A. extern double count; — redeclare as double
    2. B. extern int *count; — redeclare as a pointer
    3. C. extern int count; — redeclare as int
    4. D. extern char count; — redeclare as char

    Answer: C

    Explanation: "All declarations in the same scope that refer to the same object or function shall specify compatible types." Repeating the int declaration preserves the type. double, pointer to int, and char are different incompatible types for this object.

    Reference: WG14 N1570 — Programming languages — C — 6.7 paragraph 4

  10. 10What is the value of `12u & 10u`?

    1. A. 8
    2. B. 14
    3. C. 6
    4. D. 1

    Answer: A

    Explanation: "each bit in the result is set if and only if each of the corresponding bits in the converted operands is set" Binary 1100 AND 1010 is 1000, or 8. The distractors give inclusive OR, exclusive OR, and logical AND results instead.

    Reference: WG14 N1570 — Programming languages — C — 6.5.10 paragraph 4

Topics in this practice bank

These topics describe the available practice for CLA – C Certified Associate Programmer. Review the examination outline and its sources for scope and allocation details.

  • Language and Structures: Declarations, Definitions, Lexicon, Structures
    • Identify valid variable declarations and distinguish between definition and declaration.
    • Understand data structures: arrays, structs, and their initialization.
    • Apply proper use of storage classes (auto, static, extern).
    • Differentiate between identifiers, keywords, and constants in C.
    • Understand lexical elements, such as tokens and separators.
    • Recognize and define valid identifiers and apply naming rules.
  • Data Operations: Expressions, Pointers, Storage
    • Evaluate expressions using arithmetic, relational, logical, and bitwise operators.
    • Understand type conversions, precedence, and associativity in expressions.
    • Declare, initialize, and manipulate pointers.
    • Apply pointer arithmetic and pointer dereferencing.
    • Use arrays and pointers interchangeably in appropriate contexts.
    • Understand memory layout and storage duration.
    • Describe scope, linkage, and lifetime of variables.
  • Control Flow: Control Statements, Loops, Instructions, Functions
    • Use control statements: if, else, switch.
    • Implement loops with while, do-while, and for.
    • Apply break, continue, and goto in loop control.
    • Declare, define, and invoke functions.
    • Use function parameters and return values correctly.
    • Differentiate between call by value and call by reference using pointers.
  • Environment: Preprocessor, Stream I/O Operations
    • Apply preprocessor directives such as #define, #include, #ifdef, and #undef.
    • Understand macro definitions and conditional compilation.
    • Perform basic file I/O using fopen, fclose, fscanf, and fprintf.
    • Use formatted output with printf and format specifiers (%d, %x, %o, %s).

How to use these free practice questions

Choose an answer, check the explanation, and review your progress by chapter. Practice questions and explanations are free to access without signing up.

These are independent study questions, not actual examination items. For examination requirements and official information, view CLA – C Certified Associate Programmer details.