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