ASU CSE 240 MIDTERM
FREQUENTLY TESTED ACTUAL EXAM QUESTIONS
WITH CORRECT ANSWERS
Question 1.
In the C-Style input function scanf("%d", &i); What does the character "&" mean?
ANSWER
scanf takes the address of an variable as its parameter.
Question 2.
Given the snippet of code:
int x = 5;
int bar(int j) {
int *k = 0, m = 5;
k = &m;
return (j+m);
}
void main(void) {
static int i =0;
i++;
i = bar(i) + x;
}
ANSWER
CorrectB.
j
CorrectC.
k
CorrectD.
m
Question 3.
A fact starts with a relationship followed by a list of arguments. The arguments of a fact
ANSWER
can have a structure similar to that of a fact.
,Question 4.
One of the major differences between the imperative and functional programming languages is that
the functional programming languages do NOT
ANSWER
have side-effect.
Question 5.
Which of the following is equivalent to the expression below?
(car (cdr '(1 2 3 4 5))
ANSWER
(cadr '(1 2 3 4 5))
Question 6.
What data structure is used in Scheme for representing extremely large integers?
ANSWER
list
Question 7.
The complexity of searching an arbitrary binary search tree is the order of
ANSWER
O(n)
Question 8.
What keyword is used for defining an exception handler?
ANSWER
catch
,Question 9.
Given an expression: x1 + x2 + x3 + x4
Which language allows to evaluate the expression in this order:
(1) x1 plus x2; (2) x3 plus x4; (3) sum of ( x1 + x2 ) plus sum of ( x3 + x4 );
ANSWER
Scheme
Question 10.
Which of the following orthogonality describe this example:
If a block allows one statement, it should allow zero or more statments within that same block.
ANSWER
Number Orthogonality
Question 11.
Given this snippet of code, identify what is the stopping condition and return value?
void deleteList(struct contact* node) {
if (node == NULL) return;
else {
deleteList(node->next);
free(node);
}
}
ANSWER
deleteList(node->next);
Question 12.
When will the buffer be created?
ANSWER
When the file operation fopen is performed.
, Question 13.
int num1 = 5; //addressed at 1767612
int num2 = 10; //addressed at 1767600 int num3 = 15; //addressed at 1767588
char ch1 = 'a'; //addressed at 3734375
char ch2 = 'b'; //addressed at 3734363
char ch3 = 'c'; //addressed at 3734351
char* chPtr = &ch3;
int* iPtr = &num3;
*iPtr = num3 *(times) 8;
'*chPtr' = '*iPtr;'
What will the following statement output?
cout << ch3;
ANSWER
'x'
Question 14.
A throw statement is associated with a specific exception handler through the
ANSWER
the data type implied by the throw value.
Question 15.
Consider a path from the root to a leaf of a class tree based on the inheritance. Which class has the
most class members?
ANSWER
The class at the leaf of the tree.
Question 16.
What statement is accurate and correct?
ANSWER
There is only one Scheme list that is not a pair.
FREQUENTLY TESTED ACTUAL EXAM QUESTIONS
WITH CORRECT ANSWERS
Question 1.
In the C-Style input function scanf("%d", &i); What does the character "&" mean?
ANSWER
scanf takes the address of an variable as its parameter.
Question 2.
Given the snippet of code:
int x = 5;
int bar(int j) {
int *k = 0, m = 5;
k = &m;
return (j+m);
}
void main(void) {
static int i =0;
i++;
i = bar(i) + x;
}
ANSWER
CorrectB.
j
CorrectC.
k
CorrectD.
m
Question 3.
A fact starts with a relationship followed by a list of arguments. The arguments of a fact
ANSWER
can have a structure similar to that of a fact.
,Question 4.
One of the major differences between the imperative and functional programming languages is that
the functional programming languages do NOT
ANSWER
have side-effect.
Question 5.
Which of the following is equivalent to the expression below?
(car (cdr '(1 2 3 4 5))
ANSWER
(cadr '(1 2 3 4 5))
Question 6.
What data structure is used in Scheme for representing extremely large integers?
ANSWER
list
Question 7.
The complexity of searching an arbitrary binary search tree is the order of
ANSWER
O(n)
Question 8.
What keyword is used for defining an exception handler?
ANSWER
catch
,Question 9.
Given an expression: x1 + x2 + x3 + x4
Which language allows to evaluate the expression in this order:
(1) x1 plus x2; (2) x3 plus x4; (3) sum of ( x1 + x2 ) plus sum of ( x3 + x4 );
ANSWER
Scheme
Question 10.
Which of the following orthogonality describe this example:
If a block allows one statement, it should allow zero or more statments within that same block.
ANSWER
Number Orthogonality
Question 11.
Given this snippet of code, identify what is the stopping condition and return value?
void deleteList(struct contact* node) {
if (node == NULL) return;
else {
deleteList(node->next);
free(node);
}
}
ANSWER
deleteList(node->next);
Question 12.
When will the buffer be created?
ANSWER
When the file operation fopen is performed.
, Question 13.
int num1 = 5; //addressed at 1767612
int num2 = 10; //addressed at 1767600 int num3 = 15; //addressed at 1767588
char ch1 = 'a'; //addressed at 3734375
char ch2 = 'b'; //addressed at 3734363
char ch3 = 'c'; //addressed at 3734351
char* chPtr = &ch3;
int* iPtr = &num3;
*iPtr = num3 *(times) 8;
'*chPtr' = '*iPtr;'
What will the following statement output?
cout << ch3;
ANSWER
'x'
Question 14.
A throw statement is associated with a specific exception handler through the
ANSWER
the data type implied by the throw value.
Question 15.
Consider a path from the root to a leaf of a class tree based on the inheritance. Which class has the
most class members?
ANSWER
The class at the leaf of the tree.
Question 16.
What statement is accurate and correct?
ANSWER
There is only one Scheme list that is not a pair.