CSE 240 Midterm questions with complete
solutions
What key feature of programming languages is supported by C++, but not Java? - ans-
d d d d d d d d d d d d d dd
Pointers
In contrast to Web 1.0, what is the key function of Web 2.0? - ans-
d d d d d d d d d d d d d dd
Web is the computing platformd d d d
What computing paradigm enforces stateless (no variable allowed) programming? - ans-
d d d d d d d d d dd
Functional
What computing paradigm can solve a problem by describing the requirements, without writin
d d d d d d d d d d d d
g code in a step-wise fashion to solve the problem? - ans-logic
d d d d d d d d d d dd
What is the major improvement of structured programming languages over the earlier progra
d d d d d d d d d d d d
mming languages? - ans-Removing Goto statement from the language.
d d dd d d d d d
What is a feature of object-oriented computing? - ans-encapsulation of states
d d d d d d d dd d d
What programming languages better prepare you for leaning database query languages suc
d d d d d d d d d d d
h as SQL and LINQ? - ans-Prolog and Scheme
d d d d d dd d d
Event-driven computing paradigm is to: - ans- d d d d d dd
define a set of events and write an event handler for each event
d d d d d d d d d d d d
What programming language characteristics impact the readability of the programs written in
d d d d d d d d d d d d
this language? - ans-Control structures, Syntax design, and Data Structures
d d dd d d d d d d
Given the following code, what is the expected value for z?
d d d d d d d d d d
#include <stdio.h> d
#define func(x, y) (x > y) ? y : x d d d d d d d d d
int main() d
{
int x = 10;
d d d d d
int y = 9;
d d d d
int z = func(++x, y++);
d d d d d d
} - ans-10
d dd
Explicit type conversion is commonly referred to as __________ . - ans-Casting.
d d d d d d d d d d dd
, If you like to see accurate debugging information, which of the following program processing
d d d d d d d d d d d d d d
would you recommend? - ans-Interpretationd d d dd
What is the main reason of applying two-
d d d d d d d
step translation of high level programming language? - ans-One compiler for all machines
d d d d d d d dd d d d d
Can the identifier "base_variable" be created from the following BNF ruleset?
d
d d d d d d d d d d
<char> ::= a | b | c | ... | s | ... | x | y | z d d d d d d d d d d d d d d d d d d
<identifier> ::= <char> | <char> <identifier> - ans-No - d d d d d d dd d
there is an underscore in the identifier name that cannot be generated.
d d d d d d d d d d d d
ow many different identifiers can the following BNF ruleset generate?
d
d d d d d d d d d
<char> ::= a | b | c | ... | x | y | z d d d d d d d d d d d d d d
<identifier> ::= <char> | <char> <identifier> - ans-More than 26. d d d d d d dd d d
Which commands (constructs) do NOT have a loop when expressed in syntax graphs?
d d d d d d d d d d d d
Select all that apply - ans-If-then-else, for ( <init-expr>; <test-expr>; <increment-
d d d d d dd d d d d d
expr> ) {<statements>} , while (condition) do {statements;}
d d d d d d d
Given this snippet of code in C, d d d d d d
char alpha = 'a'; d d d
int numeric = alpha + 10;
d d d d d
which of the following statement is correct: - ans-
d d d d d d d dd
Syntactically correct, but contextually incorrect. d d d d
What is "func" in this example? d d d d d d
#include <stdio.h> d
#define func(x, y) (x > y) ? y : x d d d d d d d d d
int main() d
{
int x = 10;
d d d d
int y = 9;
d d d d
int z = func(x, y);
d d d d d
} - ans-A macro
d dd d
Which implementation of a function has potentially the best performance in terms of executio
d d d d d d d d d d d d d
n speed? - ans-macro
d d dd
Given the following code, what is the expected value for z?
d d d d d d d d d d
#define func(x, y) (x > y) ? y++ : x++ d d d d d d d d d
solutions
What key feature of programming languages is supported by C++, but not Java? - ans-
d d d d d d d d d d d d d dd
Pointers
In contrast to Web 1.0, what is the key function of Web 2.0? - ans-
d d d d d d d d d d d d d dd
Web is the computing platformd d d d
What computing paradigm enforces stateless (no variable allowed) programming? - ans-
d d d d d d d d d dd
Functional
What computing paradigm can solve a problem by describing the requirements, without writin
d d d d d d d d d d d d
g code in a step-wise fashion to solve the problem? - ans-logic
d d d d d d d d d d dd
What is the major improvement of structured programming languages over the earlier progra
d d d d d d d d d d d d
mming languages? - ans-Removing Goto statement from the language.
d d dd d d d d d
What is a feature of object-oriented computing? - ans-encapsulation of states
d d d d d d d dd d d
What programming languages better prepare you for leaning database query languages suc
d d d d d d d d d d d
h as SQL and LINQ? - ans-Prolog and Scheme
d d d d d dd d d
Event-driven computing paradigm is to: - ans- d d d d d dd
define a set of events and write an event handler for each event
d d d d d d d d d d d d
What programming language characteristics impact the readability of the programs written in
d d d d d d d d d d d d
this language? - ans-Control structures, Syntax design, and Data Structures
d d dd d d d d d d
Given the following code, what is the expected value for z?
d d d d d d d d d d
#include <stdio.h> d
#define func(x, y) (x > y) ? y : x d d d d d d d d d
int main() d
{
int x = 10;
d d d d d
int y = 9;
d d d d
int z = func(++x, y++);
d d d d d d
} - ans-10
d dd
Explicit type conversion is commonly referred to as __________ . - ans-Casting.
d d d d d d d d d d dd
, If you like to see accurate debugging information, which of the following program processing
d d d d d d d d d d d d d d
would you recommend? - ans-Interpretationd d d dd
What is the main reason of applying two-
d d d d d d d
step translation of high level programming language? - ans-One compiler for all machines
d d d d d d d dd d d d d
Can the identifier "base_variable" be created from the following BNF ruleset?
d
d d d d d d d d d d
<char> ::= a | b | c | ... | s | ... | x | y | z d d d d d d d d d d d d d d d d d d
<identifier> ::= <char> | <char> <identifier> - ans-No - d d d d d d dd d
there is an underscore in the identifier name that cannot be generated.
d d d d d d d d d d d d
ow many different identifiers can the following BNF ruleset generate?
d
d d d d d d d d d
<char> ::= a | b | c | ... | x | y | z d d d d d d d d d d d d d d
<identifier> ::= <char> | <char> <identifier> - ans-More than 26. d d d d d d dd d d
Which commands (constructs) do NOT have a loop when expressed in syntax graphs?
d d d d d d d d d d d d
Select all that apply - ans-If-then-else, for ( <init-expr>; <test-expr>; <increment-
d d d d d dd d d d d d
expr> ) {<statements>} , while (condition) do {statements;}
d d d d d d d
Given this snippet of code in C, d d d d d d
char alpha = 'a'; d d d
int numeric = alpha + 10;
d d d d d
which of the following statement is correct: - ans-
d d d d d d d dd
Syntactically correct, but contextually incorrect. d d d d
What is "func" in this example? d d d d d d
#include <stdio.h> d
#define func(x, y) (x > y) ? y : x d d d d d d d d d
int main() d
{
int x = 10;
d d d d
int y = 9;
d d d d
int z = func(x, y);
d d d d d
} - ans-A macro
d dd d
Which implementation of a function has potentially the best performance in terms of executio
d d d d d d d d d d d d d
n speed? - ans-macro
d d dd
Given the following code, what is the expected value for z?
d d d d d d d d d d
#define func(x, y) (x > y) ? y++ : x++ d d d d d d d d d