Comparison of Pascal and C - Quiz
  • 1. What happens to the control variable 'id' upon a normal exit from a for statement in Pascal?
A) It is left undefined.
B) It retains its final value.
C) It is automatically deleted.
D) It is reset to zero.
  • 2. Which language lacks a direct equivalent to the 'default' statement in control structures?
A) Both languages
B) Neither language
C) C
D) Pascal
  • 3. How do Pascal programmers typically handle the lack of a default case in case-statements?
A) By using a void function.
B) By using the goto statement.
C) By using break statements.
D) By guarding case-statements with an expression.
  • 4. What statements does C have that allow for early-out behavior in control structures?
A) Default and case
B) Jump and return
C) Exit and goto
D) Break and continue
  • 5. What feature does Pascal have that allows jumps from an inner procedure to a containing one?
A) Variadic functions
B) Pointers
C) Nested procedures/functions
D) Setjmp and longjmp
  • 6. How does C achieve the ability to jump from an inner context to an outer one?
A) Using break and continue
B) Using static declarations
C) Using setjmp and longjmp
D) Using nested functions
  • 7. Why is C's equivalent for jumps between nested routines considered arguably less safe?
A) It stores stack frames and jump addresses in a programmer accessible structure.
B) It is slower than Pascal.
C) It does not support recursion.
D) It uses global variables.
  • 8. What are routines that do not return a value called in Pascal?
A) Subroutines
B) Procedures
C) Functions
D) Void functions
  • 9. What are routines that return a value called in Pascal?
A) Void functions
B) Functions
C) Procedures
D) Methods
  • 10. What is the return type of C functions that do not return a value?
A) Empty
B) Null
C) Void
D) Nil
  • 11. Pascal procedures are considered equivalent to which C construct?
A) Function pointers
B) Void functions
C) Functions that return a value
D) Variadic functions
  • 12. Where can Pascal functions exclusively be used?
A) In an expression
B) Inside loops only
C) As global variables
D) As standalone statements
  • 13. Can a C function that returns a value be called like a void function with its return value ignored?
A) Only if declared static
B) No
C) Yes
D) Only in main()
  • 14. What are the two different types of parameters in Pascal?
A) Pass-by-stack and pass-by-register
B) Pass-by-pointer and pass-by-value
C) Pass-by-value and pass-by-reference
D) Pass-by-reference and pass-by-address
  • 15. How are parameters passed by default in C?
A) Using the address operator
B) By value
C) By reference
D) Using the VAR keyword
  • 16. How can pass-by-reference be simulated in C?
A) Using pointers
B) Using arrays
C) Using references
D) Using void
  • 17. In the PASCAL-style calling convention, in what order are parameters pushed onto the stack?
A) Random order
B) Bottom-up order
C) Right-to-left order
D) Left-to-right order
  • 18. In the STDCALL calling convention of C, in what order are parameters pushed onto the stack?
A) Right-to-left order
B) Center-out order
C) Left-to-right order
D) Reversed order
  • 19. In a Pascal-style procedure call, who cleans up the stack?
A) The callee
B) The caller
C) The operating system
D) The main function
  • 20. What is an advantage of the PASCAL call convention over STDCALL?
A) Code is slightly smaller and recursion works faster
B) It uses right-to-left parameter passing
C) It supports a variable number of parameters
D) It prevents stack overflows entirely
  • 21. What are functions that accept a variable number of parameters known as in C?
A) Variadic functions
B) Void functions
C) Dynamic functions
D) Recursive functions
  • 22. Which mechanism does C use to implement variadic functions?
A) pass-by-reference and VAR
B) va_list, va_start, and va_arg
C) setjmp and longjmp
D) varargs and pointers
  • 23. How can the localization of variables or functions be achieved in C since it lacks nesting?
A) By declaring them static within a compiling module
B) By using inner procedures
C) By using global variables
D) By using setjmp
  • 24. How does C allow functions to be indirectly invoked?
A) Through nested procedures
B) Through a function pointer
C) Through pass-by-reference
D) Through variadic lists
  • 25. How does C handle upper and lower case letters in identifiers?
A) Converts everything to uppercase
B) Case insensitive
C) Case sensitive
D) Ignores cases completely
  • 26. How does Pascal handle upper and lower case letters in identifiers?
A) Case sensitive
B) Not case sensitive
C) Strictly uppercase only
D) Strictly lowercase only
  • 27. In Pascal, are MyLabel and mylabel treated as distinct names?
A) Yes
B) Only if they are keywords
C) No
D) Only if declared globally
  • 28. In both C and Pascal, what is the rule regarding the first character of an identifier?
A) Must be an underscore
B) May not be a digit
C) Must be a vowel
D) Must be an uppercase letter
  • 29. Which language treats the underscore as a letter in identifiers?
A) Pascal
B) Neither
C) Both
D) C
  • 30. Why are names with a leading underscore often used in C?
A) To declare global constants
B) To create private functions
C) To speed up compilation
D) To differentiate special system identifiers
  • 31. What are words reserved for use by the language called?
A) Built-in types
B) Keywords
C) System identifiers
D) Subroutines
  • 32. Which of the following is a common keyword in both C and Pascal?
A) typedef
B) procedure
C) if
D) var
  • 33. Which of the following is shared as a keyword by both languages?
A) function
B) begin
C) array
D) while
  • 34. Which keyword is common to both C and Pascal?
A) string
B) const
C) record
D) enum
  • 35. In C, what are the basic built-in type names?
A) Predefined normal identifiers
B) System functions
C) Keywords or combinations of keywords
D) User-defined macros
  • 36. In Pascal, what are the built-in type names?
A) Predefined normal identifiers
B) Keywords
C) Special symbols
D) Reserved punctuation
  • 37. How is the type 'unsigned char' classified in C?
A) A punctuation mark
B) A predefined identifier
C) A combination of keywords
D) A procedure
  • 38. In Pascal subroutine definitions, what keyword is used when no value is returned?
A) typedef
B) procedure
C) void
D) function
  • 39. What keyword is used for type definitions in Pascal?
A) typedef
B) struct
C) enum
D) type
  • 40. What keyword is used for type definitions in C?
A) type
B) typedef
C) class
D) def
  • 41. What precedes a block of statements in Pascal subroutines?
A) C punctuation
B) Typedef statements
C) Global definitions
D) Local declarations
  • 42. In what year did the original Pascal definition appear?
A) 1972
B) 1970
C) 1982
D) 1969
  • 43. In what year did the first Pascal compiler appear?
A) 1970
B) 1972
C) 1989
D) 1969
  • 44. In what year did the first version of C appear?
A) 1969
B) 1970
C) 1972
D) 1982
  • 45. Both C and Pascal are descendants of which language series?
A) Assembly
B) ALGOL
C) Fortran
D) BCPL
  • 46. Pascal stems directly from which language?
A) CPL
B) BCPL
C) ALGOL 68
D) ALGOL W
  • 47. Who designed the version of Pascal referenced in the text?
A) Bjarne Stroustrup
B) Ken Thompson
C) Dennis Ritchie
D) Niklaus Wirth
  • 48. Who designed the version of C referenced in the text?
A) Alan Turing
B) John Backus
C) Dennis Ritchie
D) Niklaus Wirth
  • 49. In what year was Pascal standardized as ISO 7185?
A) 1970
B) 1982
C) 1972
D) 1989
  • 50. In what year was C standardized as C89?
A) 1982
B) 1969
C) 1989
D) 1970
  • 51. What symbol does C use instead of Pascal's 'and' keyword?
A) ||
B) ;
C) &&
D) %
  • 52. What symbol does C use instead of Pascal's 'or' keyword?
A) %
B) &&
C) #
D) ||
  • 53. What symbol does C use instead of Pascal's 'mod' keyword?
A) &&
B) /
C) ||
D) %
  • 54. What can be put on the last line before 'end' to formally insert an empty statement?
A) A comment
B) A superfluous semicolon
C) A block statement
D) An extra keyword
  • 55. Which modifiers does C use to accommodate different sizes and signed/unsigned modes for integers?
A) pointer, reference, explicit, etc.
B) byte, word, dword, etc.
C) ord, chr, subrange, etc.
D) long, short, signed, unsigned, etc.
  • 56. According to the C standard, what is the guaranteed minimum size for a char type?
A) A single byte.
B) Four bytes.
C) At least two bytes.
D) Sixteen bits.
  • 57. According to the C standard, what is the guaranteed minimum size for an int type?
A) At least four bytes.
B) Eight bytes.
C) At least two bytes.
D) Exactly one byte.
  • 58. On systems using the ASCII character set, what is the result of ord('1') in Pascal?
A) 49
B) 1
C) 33
D) 65
  • 59. On systems using the ASCII character set, what does chr(9) evaluate to in Pascal?
A) The number 9
B) A TAB character
C) A space character
D) A carriage return
  • 60. Which function is used in Pascal to convert a boolean to an integer?
A) ord
B) trunc
C) round
D) succ
  • 61. Since which C version does C have a built-in bool type?
A) C23
B) C99
C) C11
D) C89
  • 62. In pre-C23 C, where is the bool numeric datatype defined?
A) <bool.h>
B) <pascal.h>
C) <types.h>
D) <stdbool.h>
  • 63. What does C use to perform Boolean operations instead of a dedicated high-level construct?
A) Packed arrays
B) Bitwise operators
C) Sets
D) Ord functions
  • 64. What high-level method does Pascal use to deal with bitwise data?
A) Pointers
B) Arrays
C) Bitwise operators
D) Sets
  • 65. Which function is used in Pascal to convert a real to an integer by truncating the fraction?
A) round()
B) trunc()
C) ord()
D) succ()
  • 66. Which function is used in Pascal to convert a real to an integer by rounding off the fraction?
A) pred()
B) ord()
C) trunc()
D) round()
  • 67. How do you increment an enumeration variable in Pascal?
A) a = a + 1;
B) a++;
C) a := succ(a);
D) succ(a + 1);
  • 68. What compile option do practically all Pascal compilers support for arrays?
A) Dynamic length allocation
B) Pointer arithmetic
C) Automatic size adjustment
D) Range checking
  • 69. When is the number of elements in each Pascal array type determined?
A) Compile-time
B) Link-time
C) Execution-time
D) Runtime
  • 70. What operator can be used to obtain the size of a statically initialized array in C?
A) sizeof
B) count
C) length
D) extent
  • 71. What are record types termed in C?
A) Unions
B) Classes
C) Variants
D) Structures
  • 72. What feature does Pascal use in association with 'packed' to specify bit length?
A) Union construct
B) Array construct
C) Pointer construct
D) Subrange construct
  • 73. What are overlapping fields in Pascal records called?
A) Unions
B) Bitfields
C) Structures
D) Variant records
  • 74. What symbol does Pascal use as the referencing operator instead of C's asterisk (*)?
A) ^
B) #
C) @
D) &
  • 75. What symbol does Pascal use for assignment?
A) <-
B) =
C) ==
D) :=
  • 76. What symbol does C use for the equality test?
A) =
B) is
C) :=
D) ==
  • 77. What happens in Pascal if you use an assignment operator where an equality test is expected?
A) Always evaluates to false
B) Always evaluates to true
C) Implicit conversion
D) Compilation error
  • 78. Where did C get its equality test symbol (==) from?
A) ALGOL
B) Pascal
C) FORTRAN
D) B
  • 79. Which language's assignment operator style is C likened to in the text?
A) Ada
B) ALGOL
C) B
D) Pascal
  • 80. In C, what does the expression 'a = 10' evaluate to?
A) Error
B) False
C) 10
D) True
  • 81. How is the AND operator treated in Pascal?
A) Like an Addop
B) Like a conditional statement
C) Like a Mulop
D) Like an exclusive OR
  • 82. How many sets of syntax rules apply to the operators in Pascal according to the text?
A) One set
B) Three sets
C) Two sets
D) Fifteen sets
  • 83. What approach did the authors of C take regarding implementation issues?
A) The exact same approach
B) A simpler approach
C) A diametrically opposite approach
D) An approach with only one level of precedence
  • 84. How many levels of precedence are there in C according to the text?
A) 10 levels
B) 1 level
C) 15 levels
D) 2 levels
  • 85. How are arithmetic and Boolean operators treated in C?
A) As math expressions
B) As a single set of rules
C) Identically to Pascal
D) Separately
  • 86. What feature is often pointed out as a 'lack' in Pascal?
A) A preprocessor
B) Pointer arithmetic
C) Constant declarations
D) Type checking
  • 87. What was traditionally used for C's separate compilation facility?
A) An ANSI standard linker
B) A Pascal-specific linker
C) The same generic linker used for assembly language
D) A built-in macro linker
  • 88. Where does all I/O take place in C?
A) Via variant records
B) Via library calls
C) Via schema types
D) Via built-in language statements
  • 89. What does C use to find arguments to the printf function and convert them?
A) An undiscriminated variant record
B) A language processor
C) A format string
D) A system header
  • 90. How long before Java or C# did original Pascal qualify as a managed pointer language?
A) The text does not specify
B) Some 50 years
C) Some 10 years
D) Some 30 years
  • 91. What do schema types in Extended Pascal support, besides other uses?
A) Undiscriminated variant records
B) Format string interpretation
C) Variable-length arrays
D) System header files
Created with That Quiz — where a math practice test is always one click away.