Introduction to C Language and History — MCQs with detailed solutions
Q1. Who is primarily credited with developing the C programming language?
A. Ken Thompson
B. Dennis Ritchie
C. Brian Kernighan
D. Bjarne Stroustrup
Solution: Dennis Ritchie developed C at Bell Labs in early 1970s. Answer: B
Q2. In which year was the C language first implemented (approx.)?
A. 1969
B. 1972
C. 1978
D. 1989
Solution: C was implemented around 1972 on the PDP-11. Answer: B
Q3. Which operating system was rewritten in C, helping C’s popularity?
A. MS-DOS
B. CP/M
C. UNIX
D. Windows
Solution: UNIX was rewritten in C at Bell Labs, boosting portability and popularity. Answer: C
Q4. Which book, published in 1978, is widely credited with popularizing C?
A. The C++ Programming Language
B. The UNIX Programming Environment
C. The C Programming Language (K&R)
D. Programming Pearls
Solution: “The C Programming Language” by Kernighan & Ritchie (K&R) published 1978. Answer: C
Q5. Which of the following is NOT a feature of the original C?
A. Pointers
B. Dynamic memory allocation via malloc (later standardized)
C. Object-oriented classes
D. Low-level bit manipulation
Solution: Original C did not have classes; OOP is not native. Answer: C
Q6. Which language directly influenced the development of C?
A. Java
B. B (and BCPL)
C. Fortran
D. Pascal
Solution: B (itself influenced by BCPL) heavily influenced C. Answer: B
Q7. Which committee standardized the C language in 1989?
A. ANSI X3J11
B. ISO C99
C. IEEE C-1989
D. W3C
Solution: ANSI committee X3J11 produced the ANSI C standard (C89) in 1989. Answer: A
Q8. Which standard is sometimes referred to as ANSI C?
A. C90
B. C99
C. C11
D. C89
Solution: ANSI standard ratified in 1989 and adopted by ISO as C90; ANSI C commonly refers to the 1989 standard (C89/C90). Best single choice: D (C89).
(Note: ANSI C often used interchangeably with C89/C90.)
Q9. Which of the following is true about K&R C (pre-ANSI)?
A. Had full function prototypes as in ANSI C
B. Allowed implicit function declarations
C. Required strict type checking for return types
D. Disallowed pointer arithmetic
Solution: K&R C allowed implicit function declarations (no prototypes). Answer: B
Q10. Which of these is a reason C remained popular in system programming?
A. Heavy runtime checks
B. Low-level access and efficiency
C. Built-in garbage collection
D. Mandatory object orientation
Solution: C offers low-level memory access and efficient compiled code, making it ideal for systems. Answer: B
Q11. Which year corresponds to the ISO adoption of ANSI C (C90)?
A. 1990
B. 1985
C. 1999
D. 2011
Solution: ISO adopted ANSI C as ISO/IEC 9899:1990 (C90) in 1990. Answer: A
Q12. The C standard library header for input/output operations is:
A. <math.h>
B. <stdio.h>
C. <stdlib.h>
D. <string.h>
Solution: <stdio.h> provides printf, scanf, file I/O. Answer: B
Q13. Which C standard introduced the long long integer type as mandatory?
A. C89
B. C99
C. C11
D. C17
Solution: long long became standard in C99. Answer: B
Q14. Which of the following is NOT part of the C memory model?
A. Stack
B. Heap
C. Code segment
D. Object garbage collector segment
Solution: C has no built-in garbage collector. Answer: D
Q15. Which feature was formally added in C11?
A. Variable-length arrays (mandatory)
B. _Atomic keyword for atomic types
C. auto type inference like C++11
D. Garbage collection
Solution: C11 introduced concurrency features including _Atomic. Answer: B
Q16. Which standard deprecated gets() due to security concerns?
A. ANSI C89
B. K&R C
C. C11/C99 warnings leading to removal in later practices
D. C++98
Solution: gets() is unsafe and has been removed from the C11 standard library; it was deprecated earlier. Answer: C
Q17. What is the main purpose of the preprocessor in C?
A. Memory allocation
B. Source-code text substitution and conditional compilation
C. Garbage collection
D. Linking object files
Solution: Preprocessor handles #include, #define, #if, etc. Answer: B
Q18. The directive #include <stdio.h> performs:
A. Runtime import of library
B. Preprocessor substitution of header contents into source
C. Linking object files
D. Defining macros dynamically at runtime
Solution: #include instructs preprocessor to paste header content into source before compilation. Answer: B
Q19. Which of these is a valid C identifier?
A. 3count
B. _sum
C. int
D. sum-total
Solution: Identifiers cannot start with digit; keywords not allowed; hyphen not allowed. _sum is valid. Answer: B
Q20. Which of the following best describes undefined behavior (UB) in C?
A. A clearly defined runtime error message
B. The C standard imposes no requirements — anything may happen
C. Triggers a compile-time warning only
D. Always causes program to abort
Solution: UB means the standard imposes no constraints; behavior is unpredictable. Answer: B
Q21. Which of these can cause undefined behavior?
A. Accessing array out of bounds
B. Using only standard library functions correctly
C. Reading a const variable
D. Declaring variables
Solution: Accessing out-of-bounds array is UB. Answer: A
Q22. The sizeof operator applied to an array returns:
A. Number of elements only
B. Total size in bytes of array (if applied in same scope)
C. Size of pointer to array
D. Undefined value
Solution: sizeof(array) yields total bytes for the array (not number of elements). Answer: B
Q23. In the expression a[b], C defines it as equivalent to:
A. *(a + b)
B. *(a - b)
C. &a[b]
D. a + b
Solution: a[b] is defined as *(a + b); symmetric so b[a] valid if types permit. Answer: A
Q24. Which of these memory allocation functions returns NULL on failure?
A. malloc
B. printf
C. free
D. sizeof
Solution: malloc returns NULL when memory allocation fails. Answer: A
Q25. Which header contains the declaration for malloc and free?
A. <stdio.h>
B. <stdlib.h>
C. <memory.h>
D. <alloc.h>
Solution: <stdlib.h> declares malloc, free, calloc, realloc. Answer: B
Q26. In classic C, what does char typically represent?
A. A Unicode codepoint (full)
B. A single byte — implementation-defined signedness
C. Always signed 16-bit
D. Always unsigned 8-bit
Solution: char is one byte; whether signed or unsigned is implementation-defined. Answer: B
Q27. Which of the following is valid for pointers in C?
A. Pointer arithmetic allowed between unrelated object pointers
B. You can add two pointers
C. You can subtract pointers to elements of same array (yielding difference)
D. Pointer arithmetic ignores element size
Solution: Pointer subtraction of pointers to same array is defined; addition of two pointers is not. Answer: C
Q28. Which C keyword indicates that a function does not return a value?
A. void
B. null
C. none
D. empty
Solution: void used as return type when no value is returned. Answer: A
Q29. Which of these is the correct signature for main in standard C?
A. int main() or int main(int argc, char *argv[])
B. void main() only
C. main void
D. int main(char **argv, int argc)
Solution: Standard C allows int main(void) or int main(int, char*[]). Answer: A
Q30. The term “portable” in C context primarily refers to:
A. Code running on different platforms with minimal changes
B. Code compiled only on one machine
C. Source code being small in size
D. Using pointers everywhere
Solution: Portability: ability to move code across platforms with minimal changes. Answer: A
Q31. Which C standard introduced support for complex numbers (_Complex)?
A. C89
B. C99
C. C11
D. K&R C
Solution: Complex numbers introduced in C99. Answer: B
Q32. What does the volatile qualifier indicate to the compiler?
A. Variable never changes
B. Variable may change unexpectedly outside program flow (avoid optimizations)
C. Variable is constant at runtime
D. Variable stored in read-only memory
Solution: volatile tells compiler not to optimize accesses since value can change externally. Answer: B
Q33. Which header introduces integer types with exact widths like int32_t?
A. <stdint.h>
B. <inttypes.h>
C. <stddef.h>
D. <limits.h>
Solution: <stdint.h> (introduced in C99) provides int32_t, uint64_t, etc. Answer: A
Q34. The constraint const means:
A. Variable stored in ROM always
B. Variable should not be modified through normal program flow (read-only)
C. Compiler enforces at runtime only
D. Variable occupies zero memory
Solution: const indicates that object should not be modified via that name; stored location may be mutable but cannot be modified through that reference. Answer: B
Q35. Which of the following is true about function prototypes?
A. They provide type information for parameters and return value to the compiler
B. They are optional and do nothing
C. They are only for documentation and ignored by compiler
D. They allow function overloading
Solution: Prototypes give compiler parameter and return types for checking calls. Answer: A
Q36. Which operator has the highest precedence among these?
A. + (addition)
B. * (multiplication)
C. == (equality)
D. = (assignment)
Solution: Multiplication * has higher precedence than addition, relational, assignment. Answer: B
Q37. C uses which evaluation order guarantee for the operands of the + operator?
A. Left-to-right guaranteed
B. Right-to-left guaranteed
C. Unspecified (but sequence points and side effects matter)
D. Always parallel evaluation
Solution: Order of evaluation for operands generally unspecified; side effects before sequence points are important. Answer: C
Q38. Which of these is NOT a storage class specifier in C?
A. auto
B. register
C. static
D. temporary
Solution: temporary is not a C storage class. Answer: D
Q39. The extern keyword is used to:
A. Define a function inside a file only
B. Declare a variable/function defined elsewhere (external linkage)
C. Allocate memory dynamically
D. Force inline expansion
Solution: extern declares external linkage for variables/functions defined in other translation units. Answer: B
Q40. Which header provides macro NULL?
A. <stddef.h> and <stdio.h> often provide it; <stdlib.h> may too
B. <math.h> only
C. None provide NULL
D. <string.h> exclusively
Solution: NULL is in <stddef.h>, and commonly in <stdlib.h> and <stdio.h>. Best answer: A
Q41. Which of these functions is used to print formatted output?
A. scanf
B. printf
C. getchar
D. fopen
Solution: printf prints formatted output. Answer: B
Q42. What does fopen return if it fails to open a file?
A. 0
B. NULL
C. -1
D. Undefined random pointer
Solution: fopen returns NULL on failure. Answer: B
Q43. Which of the following is TRUE about pointers and arrays?
A. An array name always behaves exactly like a pointer (identical)
B. An array decays to pointer to its first element in many expressions, but not when used with sizeof or as operand of & in definition context
C. Pointers and arrays are indistinguishable in C type system
D. sizeof(arr) always equals sizeof(pointer)
Solution: Array decays to pointer in many contexts but not always. Answer: B
Q44. Which of these is a correct way to allocate 10 integers dynamically?
A. int *p = malloc(10);
B. int *p = malloc(10 * sizeof(int));
C. int p = malloc(10 * sizeof(int));
D. int *p = calloc(sizeof(int), 10);
Solution: malloc(10 * sizeof(int)) is correct. (Also calloc(10, sizeof(int))). Answer: B
Q45. For portability, which expression is preferred to compute number of elements in array arr?
A. sizeof(arr)
B. sizeof(arr)/sizeof(arr[0])
C. arr.length
D. length(arr)
Solution: sizeof(arr)/sizeof(arr[0]) yields element count (only inside same scope where arr is array). Answer: B
Q46. Which of the following will definitely cause a memory leak (assuming no further code frees memory)?
A. int *p = malloc(10 * sizeof(int)); p = NULL;
B. int a[10];
C. int *p = malloc(10 * sizeof(int)); free(p);
D. int *p = NULL;
Solution: Overwriting pointer with NULL before free loses allocated memory reference -> leak. Answer: A
Q47. The typedef keyword in C is used to:
A. Create new type names (aliases)
B. Allocate memory
C. Define functions
D. Import types from other modules
Solution: typedef creates a new alias for types. Answer: A
Q48. Which header contains memcpy?
A. <string.h>
B. <memory.h> (often same as <string.h>)
C. Both A and B depending on implementation
D. <stdio.h>
Solution: Standard header is <string.h> (some systems provide <memory.h> as same). Best: A (and C is also acceptable in practice). Answer: A
Q49. Which operator yields address of variable?
A. *
B. &
C. #
D. @
Solution: & operator yields the address. Answer: B
Q50. In C, *p denotes:
A. Multiplication only
B. Dereferencing pointer p (lvalue) or multiplication depending on context
C. Address-of operator
D. Concatenation
Solution: * is dereference when applied to pointer (or multiplication in arithmetic context). Answer: B
Q51. Which library function converts string to integer?
A. atoi, strtol
B. strcpy
C. memset
D. sprintf
Solution: atoi, strtol convert strings to integers (strtol is safer). Answer: A
Q52. Which of following describes a translation unit?
A. A compiled executable
B. A single source file after preprocessing (source + included headers)
C. A header file only
D. The whole program only after linking
Solution: A translation unit is the result of preprocessing one source file + headers; compiled to object file. Answer: B
Q53. What does the linker do?
A. Translate C to machine code
B. Combine object files and resolve symbol references into an executable
C. Execute the program
D. Optimize algorithms inside source code
Solution: Linker resolves references across object files and produces executable. Answer: B
Q54. Which of the following is NOT true about C’s type system?
A. C supports function pointers
B. C allows implicit conversions between pointer types without cast (may warn)
C. C has strong runtime dynamic type checking
D. C has limited type safety compared to higher-level languages
Solution: C lacks runtime dynamic type checking; so statement C is false. Answer: C
Q55. The restrict qualifier (introduced in C99) indicates:
A. Pointer cannot be dereferenced
B. Pointer is the only way to access the object during its lifetime (enables optimization)
C. Pointer stored in ROM
D. Pointer is constant pointer (can’t change)
Solution: restrict promises no other pointer will access same object to allow optimizations. Answer: B
Q56. In C, which of these initializers is valid for an array of 3 ints?
A. int a[3] = {1,2,3};
B. int a[3] = {1,2,3,4};
C. int a[] = {1,2,3,4}; (size unspecified but initializer length 4)
D. Both A and C (C is valid with size inferred)
Solution: A is valid; C is valid but not with declared size 3. Since question asks which is valid for array of 3 ints specifically: A.
Q57. Which operator in C has the same precedence as * (multiplicative)?
A. +
B. / and %
C. <<
D. ==
Solution: Multiplicative operators include *, /, % which share same precedence. Answer: B
Q58. Which function should be used to safely read a line to avoid buffer overflow (deprecated ones excluded)?
A. gets (unsafe)
B. fgets
C. scanf("%s", buf) (unsafe)
D. gets_s (optional/implementation-specific)
Solution: fgets is standard and safe when given buffer size. Answer: B
Q59. Which of these is a correct comment in C99 style?
A. /* comment */ only
B. // comment or /* comment */ (C99 allows //)
C. # comment
D. -- comment
Solution: C99 introduced // single-line comments; block comments /* */ always valid. Answer: B
Q60. Which keyword declares a variable whose lifetime is the entire program execution and internal linkage?
A. auto
B. static at file scope
C. register
D. volatile
Solution: static at file scope yields internal linkage and static lifetime. Answer: B
Q61. In ISO C, integer promotion rules mean that char operands in arithmetic are promoted to:
A. char always
B. int or unsigned int depending on range
C. long long
D. float
Solution: Smaller integer types promoted to int (or unsigned int) per integer promotion rules. Answer: B
Q62. Which header defines size_t?
A. <stddef.h> and <stdio.h> and <stdlib.h> often define it; standard is <stddef.h>
B. <stdint.h>
C. <math.h>
D. <ctype.h>
Solution: size_t is defined in <stddef.h> (and in others); best: A
Q63. The %zu printf conversion specifier is used to print:
A. size_t values
B. int values
C. long values
D. double values
Solution: %zu prints size_t. Introduced in C99/C11. Answer: A
Q64. Which of these is true about enum in C?
A. Each enumerator must be unique integer constant; underlying type is integer (implementation-defined)
B. enum behaves exactly like typedef
C. enum values are always strings at runtime
D. enum cannot be used in switch-case statements
Solution: Enum constants are integers; underlying type is implementation-defined (commonly int). Answer: A
Q65. Which operator yields remainder of integer division?
A. /
B. %
C. //
D. mod
Solution: % is modulo (remainder) operator. Answer: B
Q66. Which of these is a side-effect that can make expressions undefined if sequence points are not respected?
A. Modifying the same scalar twice between sequence points (e.g., i = i++ + ++i)
B. Using only constants
C. Reading only constant variables
D. Using sizeof operator
Solution: Modifying a scalar multiple times without intervening sequence point yields UB. Answer: A
Q67. Which of the following is true about inline functions (C99)?
A. inline is purely a hint; semantics differ with external/inline definitions and linkage rules
B. Guarantees inlining always
C. Replaces macros entirely
D. Not allowed in C99
Solution: inline is a hint; linking semantics require care (extern inline vs inline). Answer: A
Q68. Which of the following helps prevent buffer overflow on string copy?
A. strcpy(dest, src) always safe
B. strncpy(dest, src, n) with proper handling ensures safety (careful with non-null-terminated result)
C. gets is safe
D. sprintf safe always
Solution: strncpy with proper size and terminating null can help; but must ensure termination. Answer: B
Q69. Which of these standard headers contains macros for integer limits like INT_MAX?
A. <limits.h>
B. <float.h>
C. <limits>
D. <stdlib.h>
Solution: <limits.h> contains INT_MAX, CHAR_BIT, etc. Answer: A
Q70. Which of these is NOT a valid conversion specifier for printf?
A. %d
B. %f
C. %q
D. %s
Solution: %q is not standard. Answer: C
Q71. Which of the following best describes “sequence point” concept in C (pre-C11)?
A. A point in execution where all side-effects of previous evaluations are complete and no side-effects of subsequent evaluations have started
B. A compile-time only concept
C. A feature to allocate memory
D. Another name for function calls only
Solution: Sequence points define ordering of side effects during evaluation. Answer: A
Q72. Which C standard introduced multi-threading support (as a library) in standardized form?
A. C89
B. C99
C. C11 (threads.h optional feature)
D. C17
Solution: C11 introduced optional <threads.h> and atomic features. Answer: C
Q73. Which of these is a correct cast in C?
A. (int) 3.14
B. int(3.14)
C. cast<int>(3.14)
D. 3.14 as int
Solution: C-style cast (int)3.14 is correct. Answer: A
Q74. Which is true about fseek and ftell?
A. fseek sets file position; ftell returns current position (long)
B. ftell writes to file
C. fseek reads file contents
D. None of the above
Solution: fseek moves file pointer; ftell returns current position. Answer: A
Q75. Which of the following statements about C macros is true?
A. Macros are processed by preprocessor and are simple textual substitutions
B. Macros are type-checked by compiler
C. Macros are runtime functions
D. Macros have same scoping as variables
Solution: Macros are textual substitution done before compilation. Answer: A
Q76. Which of these pitfalls is common with macros?
A. Unexpected operator precedence unless parenthesized properly
B. Automatic type safety
C. Enforced debugging info
D. Garbage collection
Solution: Macros need parentheses to avoid precedence surprises. Answer: A
Q77. Which header contains offsetof macro useful for computing offset of member in struct?
A. <stddef.h>
B. <stdio.h>
C. <stdlib.h>
D. <stdint.h>
Solution: offsetof is in <stddef.h>. Answer: A
Q78. In C, bit-fields inside struct are specified like unsigned int flag:1;. Which is TRUE?
A. Bit-field width must be constant integer expression
B. Bit-fields can be float
C. Bit-field width may be dynamic at runtime
D. Bit-fields always start on new byte boundary
Solution: Bit-field width is compile-time constant. Answer: A
Q79. Which of these best describes linkage of identifiers?
A. Internal linkage (file scope static), external linkage (global), no linkage (block scope local auto)
B. All identifiers have external linkage always
C. Linkage determines data type only
D. Linkage equals visibility at runtime only
Solution: Linkage determines if name refers to same entity across translation units: internal, external, or none. Answer: A
Q80. Which is TRUE about scanf when reading strings with %s?
A. It automatically prevents buffer overflow
B. You must specify max field width to avoid overflow (e.g., %9s)
C. Always safe equivalent to fgets
D. Reads entire line including spaces by default
Solution: %s stops at whitespace and can overflow; specify field width to avoid overflow. Answer: B
Q81. Which of the following makes code undefined: returning address of a local stack variable?
A. Safe and valid always
B. Undefined — pointer will dangle after function returns
C. Always works on modern compilers
D. Equivalent to returning by value
Solution: Returning address of local variable yields dangling pointer (UB). Answer: B
Q82. Which of following is a valid way to declare function pointer for function int f(double)?
A. int (*fp)(double);
B. int fp(double)*;
C. (*fp) int(double);
D. func ptr int(double)
Solution: int (*fp)(double); is correct syntax for pointer to function taking double returning int. Answer: A
Q83. In C, union allows:
A. Storage of one of several types in same memory location sharing space
B. Storing multiple values simultaneously safely without overlap
C. No memory sharing allowed
D. Only functions allowed in union
Solution: Union shares memory among members; only one is active at a time. Answer: A
Q84. Which standard facility helps to write portable format specifiers for int64_t?
A. <inttypes.h> with macros like PRId64
B. <stdio.h> only
C. <stdarg.h>
D. None needed; %lld always correct
Solution: <inttypes.h> defines PRId64 etc. for portable printing. Answer: A
Q85. Which of the following is a common use of volatile?
A. Hardware register access and signal handlers where value may change asynchronously
B. Optimize reads aggressively away
C. Implement const correctness
D. Replace locks for concurrency safety
Solution: volatile is used for memory-mapped hardware or variables modified outside program flow; not a concurrency replacement. Answer: A
Q86. Which of the following describes “translation phase” where macro expansion occurs?
A. Preprocessing phase before compilation
B. Link time only
C. Runtime only
D. After linking
Solution: Preprocessing (phase 4) performs macro expansion before compilation. Answer: A
Q87. Which statement about realloc is TRUE?
A. realloc can move memory block and return new pointer; old pointer is invalid if returned pointer different (unless NULL on failure)
B. realloc always preserves original pointer
C. realloc never fails
D. realloc used only for shrinking file sizes
Solution: realloc may move block; if returns non-NULL, old pointer should not be used. If returns NULL, original remains unchanged. Answer: A
Q88. Which of the following is a non-standard but commonly supported extension in many C compilers?
A. Nested functions (GCC extension)
B. Standardized exceptions
C. Mandatory bounds checking
D. Built-in garbage collection
Solution: GCC supports nested functions as extension; others are not standard. Answer: A
Q89. Which of these is the correct way to check compile-time assertion in C11?
A. _Static_assert(condition, "message");
B. static_assert only in C++
C. #assert in preprocessor
D. assert runtime only
Solution: C11 provides _Static_assert. Answer: A
Q90. Which of the following is true regarding sizeof(char)?
A. Always 1 by definition (one byte), but number of bits in a byte can vary (CHAR_BIT)
B. Always 8 bits universally in standard
C. Varies in bytes across platforms at runtime
D. Can be 0 on some systems
Solution: sizeof(char) is 1, but a byte may be more than 8 bits; CHAR_BIT macro defines bits per byte. Answer: A
Q91. Which of the following is a safe way to concatenate strings into a buffer?
A. Use strncat with proper remaining buffer size management
B. Use strcpy blindly
C. Use sprintf without width limit
D. Rely on undefined behavior to save code
Solution: strncat or snprintf with correct size checks is safer; strcpy/sprintf without limit unsafe. Answer: A
Q92. The concept of “undefined behavior” allows compilers to:
A. Make optimizations that assume undefined behaviors do not occur in correct programs
B. Preserve semantics of UB across platforms always
C. Throw exceptions at runtime automatically
D. Do nothing special
Solution: UB enables compilers to assume undefined cases won’t happen, enabling optimizations. Answer: A
Q93. Which header is required for variadic function macros like va_start?
A. <stdarg.h>
B. <varargs.h> (deprecated)
C. <stdio.h>
D. <stdlib.h>
Solution: <stdarg.h> defines va_start, va_arg, va_end. Answer: A
Q94. Which is true about flexible array members in structs (C99)?
A. Last member declared as array with no size (e.g., int data[];) allowed as last member to create dynamic-sized tail
B. Can appear anywhere in struct
C. Must have explicit size
D. Deprecated in C99
Solution: Flexible array member must be last member and has no size; used for variable-sized tail. Answer: A
Q95. assert(expr) macro from <assert.h> does what in debug builds?
A. If expr false, prints message and aborts (implementation-defined output)
B. Converts expr to true always
C. Is removed in debug builds only
D. Allocates memory
Solution: assert checks expression and aborts program with diagnostic if false (when NDEBUG not defined). Answer: A
Q96. Which of the following regarding volatile and atomic is correct?
A. volatile is not a substitute for atomic operations or locks; _Atomic (C11) provides atomic semantics
B. volatile guarantees atomicity of operations
C. _Atomic and volatile are identical in semantics
D. volatile is deprecated in favor of _Atomic always
Solution: volatile prevents optimization but doesn’t ensure atomicity; C11’s _Atomic provides atomic semantics. Answer: A
Q97. Which is the correct way to create a macro that expands to the number of elements in an array?
A. #define ARRAY_LEN(x) (sizeof(x) / sizeof((x)[0]))
B. #define ARRAY_LEN(x) sizeof(x)
C. #define ARRAY_LEN(x) x.len
D. #define ARRAY_LEN(x) 0
Solution: Correct macro uses sizeof total divided by element size. Answer: A
Q98. Which of these is true about extern "C"?
A. It’s a C++ linkage specification to disable name mangling so C functions can be called from C++
B. Part of standard C
C. Used to declare external hardware registers
D. Replaces extern in C
Solution: extern "C" is C++ feature to use C linkage; not a C construct. Answer: A
Q99. The trusted K&R book (first edition) described C based on:
A. The dialect used at Bell Labs in early 1970s (pre-ANSI)
B. ISO C99 standard exactly
C. Java syntax
D. C++ templates
Solution: K&R described the original Bell Labs dialect prior to ANSI standardization. Answer: A
Q100. Which ISO standard revision of C emphasizes multi-threading and atomics as first-class features?
A. C89
B. C99
C. C11
D. K&R C
Solution: C11 introduced standardized threads and atomic support. Answer: C