CS 4337 Exam 1 Review
True
Pascal became the most widely used introductory language
True
Java uses a hybrid approach of compiling and interpreting.
False
JavaScript is the same language as Java.
The form of a language. A precise description of all the grammatically correct programs in a programming language.
Syntax
True
Synthesized attributes are used to pass semantic information up a parse tree.
Represent the alphabet of the language being defined
Terminal symbol
True
A "strong type system" is described as one in which there is no possibility of an unchecked run-time type error. In other words, the absence of unchecked run time errors is referred to as safety or type safety.
Terminals.
In a parse tree, what do leaf nodes indicate?
interpreter
A program which interprets each line of high level program at time of execution is called
True
A recursive descent parser can not directly use a grammar that has left recursive rules.
True
A strongly typed programming language is one that detects all type errors either at compile time or a run time.
True
All phases of a compiler use a symbol table.
True
An actual_type is a synthesized attribute that stores the actual type of a variable or expression.
False
An advantage of using a compiler is that it generally produces portable code able to fun on many different hardware and software platforms.
assembly code into machine code
An assembler translates
False
An expected_type is a synthesized attribute associated with non-terminal that stores the expected type of an expression.
False
An operator's precedence determines whether it associates to the left or right.
C, C++
Applications developed by programming languages like ____ and ______ have this common buffer overflow error.
specify the static semantics of a programming language
Attribute grammars are used to
False
In an abstract data type, the data representation of the type is the focus.
True
Buffer-overflow attack can take place if a machine can execute a code that resides in the data/stack segment.
boundary checks
Buffer-overflow may remain as a bug in apps if __________ are not done fully.
False
C has strong type-checking
dynamically
In an application that uses heap, the memory for data is allocated
True
Denotational semantics is based on recursive function theory.
{ }
EBNF for a series of zero or more; iteration
Only static type checking is done
For strongly-typed languages
Easy development
From the point of view of the programmer what are the major advantages of using a high-level language rather than internal machine code or assembler language?
Easy development
From the point of view of the programmer what are the major advantages of using ahigh-level language rather than internal machine code or assembler language?
left
Given the following BNF grammar for a language with two infix operators represented by # and $. <bar> → <baz><foo> → <bar> $ <foo><baz> → ( <foo> )<bar> → <bar> # <baz><baz> → x | y<foo> → <bar> What is the associativity of the # operator:
right
Given the following BNF grammar for a language with two infix operators represented by # and $. <bar> → <baz><foo> → <bar> $ <foo><baz> → ( <foo> )<bar> → <bar> # <baz><baz> → x | y<foo> → <bar> What is the associativity of the $ operator:
#
Given the following BNF grammar for a language with two infix operators, <bar> → <baz><foo> → <bar> $ <foo><baz> → ( <foo> )<bar> → <bar> # <baz><baz> → x | y<foo> → <bar> Which operator has higher precedence:
True
If the grammar for a language is unambiguous, then there is only one way to parse each valid sentence in that language.
Whatever is at A[555] will be overwritten
If you declare an array as A[100] in C and you try to write data to A[555], what will happen?
Preconditions and Postconditions
In Axiomatic semantics, the meaning of a specific statement is defined by:
Syntax analysis
In which phase in compiler design do we check the grammar of the programming language?
List Processing
Lisp is the second oldest high level programming language. Here Lisp stands for
False
Machine code includes English words for basic computer commands.
False
Markup languages are general purpose programming languages.
False
Most programming languages are implemented as interpreters these days.
EBNF vs BNF
Not more powerful, but its rules are often simpler and clearer
Formal Logic
On what branch of mathematics is axiomatic semantics based?
False
One of the advantages of interpreted languages is their faster execution time compared to compiled languages.
Components of a grammar
Productions, non-terminal symbols, terminal symbols, and a start symbol that must be a non-terminal.
interpreter
Program used for interactive computing is
FORTRAN
Programming language which is used for scientific purposes in batches is
Syntax
Programming languages have __________ , just like natural languages.
Logic Programming
Prolog comes under ___________
True
Python is interpreted.
functional-oriented
Scala is part of the: ____?
Scalable language
Scala is short form of
True
The "Von Neumann" computer architecture is characterized by hardware that has a CPU separate from memory, which is used to hold both data and programs.
False
The EBNF notation allows one to define grammars that can not be defined using the simpler BNF notation.
C
The ________________ programming language is an example of a compiled language.
False
The lexical structure of complex programming languages like Java can not be defined using BNF
Denotational semantics
The most rigorous and most widely known formal method for describing the meaning of programs?
Derivation
The outcome of replacing a non-terminal by the right-hand side of one of its productions
add comments to it
To made program more easier to understand, programmers can
The Dangling Else
Unable to determine with which 'if' the following 'else' associates
the value of i in s
VARMP(i, s) produces?
heap
Variables that get created dynamically when a function (such as malloc()) is called is created in the form of _______ data structure.
Cobol
What PL is used for business applications?
Fortran
What PL is used for scientific applications?
machine language, assembly language, high level language
What are the three main types of computer programming languages?
Security-sensitive data, A return pointer, Any kind of pointer, Anything that will make the program crash
What can be overwritten by a buffer overflow that causes a security problem?
block statement
What innovation introduced in ALGOL68 is often credited to Pascal?
the type system that guarantees not to generate type errors.
What is a strong type system?
machine language, different for every type of CPU
What is the only language that a computer understands directly?
LISP
What programming language is used for artificial intelligence?
Java
What programming language is used for internet programming?
C
What programming language is used for system programming?
Whatever is in the memory space that comes after the buffer is overwritten
What typically happens when a buffer is overflowed?
top-down parsing
When the parser starts constructing the parse tree from the start symbol and then tries to transform the start symbol to the input, it is called?
On the stack before the return pointer, On the stack after the return pointer, In the stack frame of another function, On the heap
Where can an attacker who is trying to "smash the stack" put their attack code if the buffer to be overflowed is on the stack? (5)
Algol
Which PL is considered an ancestor to C, Java, and Ruby?
hierarchical
Which following term(s) is not a PL programming paradigm?
Pointer arithmetic
Which kinds of operations are most likely to lead to buffer overflows in C?
Assembly
Which of the following is not a high level programming language?
To enable the program to be run on multiple platforms.
Which of the following is not an advantage of using a low level language?
Reduce complexity
Which of the following is the functionality of 'Data Abstraction'?
Symbol Table
Which of the following is the name of the data structure in a compiler that is responsible for managing information about variables and their attributes? Choose ONE.
Encapsulation, Inheritance, Polymorphism
Which of the following mechanisms is/are provided by Object Oriented Language to implement Object Oriented Model?
Java
Which of the following programming languages is not susceptible to a stack-based buffer overflow attack?
int *p = (int*) malloc(50);
Which one of the following is an example of an explicit heap-dynamic variable?
Python
Which one of the following languages supports dynamic type binding?
<number> -> <digit> | <digit><number>| ε<digit> -> 0 | 1
Which one of these grammars can produce the string 1010? where ε is the empty string.
Lexer
Which program groups characters in code into tokens in a compiler?
Denotational semantics
__________ is based on recursive function theory.
Byte code
_______________ is the assembly language for an imaginary architecture.