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