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