Quiz 11 Flashcards
(10 cards)
Which of the following best describes a block in programming?
A runtime error caused by invalid memory access; A method for iterating over collections; A set of statements enclosed in {} that defines a scope; A type of conditional statement
A set of statements enclosed in {} that defines a scope
What is “scope” in a programming language?
The place where the variable is stored; The region in a program where a variable can be accessed; The data type of a variable; The lifetime of a variable
The region in a program where a variable can be accessed
What is a key disadvantage of dynamic scoping?
It results in slower program execution; It forces variables to be global; It uses more memory during runtime; It makes code harder to debug due to less predictable variable resolution
It makes code harder to debug due to less predictable variable resolution
What is the primary purpose of a symbol table in a compiler?
To store information about identifiers
To keep track of syntax rules
To store program code
To generate machine code
To store information about identifiers
What is “semantics” in programming languages?
The syntax rules of a language
The use of data structures
How programs are compiled
The study of meaning in programming constructs
The study of meaning in programming constructs
Which of the following is NOT a method for specifying semantics?
Defining a translator
Syntax tree compression
Language reference manual
Formal definition
Syntax tree compression
If binding time is _____, it is considered as dynamic binding.
Execution time
Link time
Translation time
Language definition time
Execution time
Which of the following syntax errors cannot be detected using a symbol table?
Duplicate declaration of variables
Misplaced semicolons
Type mismatches in assignments
Use of undeclared variables
Misplaced semicolons
What is binding in programming languages?
The process of debugging a program
The process of resolving a method call at runtime
The process of converting source code into machine code
The process of associating an attribute with a name
The process of associating an attribute with a name
When analyzing nested scopes, why is a stack an appropriate data structure?
Because it maintains a LIFO order, aligning with how nested scopes are entered and exited
Because it supports bidirectional traversal
Because it provides constant time-access to all variables
Because it allows elements to be accessed randomly
Because it maintains a LIFO order, aligning with how nested scopes are entered and exited