CSE 240 FINAL EXAM COMPREHENSIVE
QUESTIONS AND SOLUTIONS
◉ Interpretation of a program is the direct execution of one
statement at a time sequentially. (T/F)
Answer: True
◉ Functional programming languages are low-level languages.
(T/F)
Answer: False
◉ Programming language uses two-step translation with
intermediate codes for execution.
Answer: Java
◉ What is a data type?
Answer: a set of primary values and the operations defined on
these values.
◉ The compiler executes the program (T/F).
Answer: False
,◉ Semantic structure: Imperative Programming
Answer: type matching;
parameters type in a function declaration should match these in
the function call;
unicity
◉ Compilation of a program is to execute all the statements of the
program completely. (T/F)
Answer: False
◉ During compilation, all the statements of a program in high-
level language are converted (translated) to a low-level language.
(T/F)
Answer: True
◉ Lexical structure of all programming languages include:
Answer: identifiers
keywords
operators
literals
◉ (C Programming)
What is the output of the code below:
, #include <stdio.h>
int fun (int n) {
if (n == 4)
return n;
else
return 2*fun(n+1);
}
int main() {
printf("%d", fun(3));
return 0;
}
Answer: 8
◉ (C Programming)
What is printed by the following code:
#include <stdio.h>
int i=10;
int bar(int m, int *n) {
printf("i=%d k=%d l=%d\n", i,m,*n);
QUESTIONS AND SOLUTIONS
◉ Interpretation of a program is the direct execution of one
statement at a time sequentially. (T/F)
Answer: True
◉ Functional programming languages are low-level languages.
(T/F)
Answer: False
◉ Programming language uses two-step translation with
intermediate codes for execution.
Answer: Java
◉ What is a data type?
Answer: a set of primary values and the operations defined on
these values.
◉ The compiler executes the program (T/F).
Answer: False
,◉ Semantic structure: Imperative Programming
Answer: type matching;
parameters type in a function declaration should match these in
the function call;
unicity
◉ Compilation of a program is to execute all the statements of the
program completely. (T/F)
Answer: False
◉ During compilation, all the statements of a program in high-
level language are converted (translated) to a low-level language.
(T/F)
Answer: True
◉ Lexical structure of all programming languages include:
Answer: identifiers
keywords
operators
literals
◉ (C Programming)
What is the output of the code below:
, #include <stdio.h>
int fun (int n) {
if (n == 4)
return n;
else
return 2*fun(n+1);
}
int main() {
printf("%d", fun(3));
return 0;
}
Answer: 8
◉ (C Programming)
What is printed by the following code:
#include <stdio.h>
int i=10;
int bar(int m, int *n) {
printf("i=%d k=%d l=%d\n", i,m,*n);