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