CSE 240 EXAM 1 QUICK REVISION
FLASHCARDS 2026
◉ What is the value in the variable Exam::total that is printed when
this program is executed?
#include<iostream>
using namespace std;
class Exam {
public:
static int total;
Exam() {
total++; }
};
int Exam::total = 0;
int main(){
Exam a, b, c;
Exam *d, *e, *f = new Exam;
cout << Exam::total;
,}.
Answer: 4
◉ a delete instruction is needed before the main() ends.
Which of the following options is correct?
#include<iostream>
using namespace std;
class MyClass {
public:
MyClass() {cout << "MyClass constructed\n";}
~MyClass() {cout << "MyClass destroyed\n";}
};
int main(){
MyClass * pt = new MyClass[3];
return 0;
}.
Answer: delete [ ] pt;
◉ The semantic structure of imperative programming languages
normally include which of the following validations
,parameters type in a function declaration should match these in the
function call.
division by zero
statement should end with a ';'
unicity
a variable name should start with a letter, '$' or '_'
type matching.
Answer: parameters type in a function declaration should match
these in the function call.
unicity
type matching
◉ The syntactical structure of the imperative programming
language reviewed in this course include which of the following
validations
, unicity
statement should end with a ';'
type matching
a variable name should start with a letter, '$' or '_'
division by zero
parameters type in a function declaration should match these in the
function call..
Answer: statement should end with a ';'
◉ Running the following program,
How many times the message "constructing" is printed on the
screen?
#include<iostream>
using namespace std;
class Rectangle {
FLASHCARDS 2026
◉ What is the value in the variable Exam::total that is printed when
this program is executed?
#include<iostream>
using namespace std;
class Exam {
public:
static int total;
Exam() {
total++; }
};
int Exam::total = 0;
int main(){
Exam a, b, c;
Exam *d, *e, *f = new Exam;
cout << Exam::total;
,}.
Answer: 4
◉ a delete instruction is needed before the main() ends.
Which of the following options is correct?
#include<iostream>
using namespace std;
class MyClass {
public:
MyClass() {cout << "MyClass constructed\n";}
~MyClass() {cout << "MyClass destroyed\n";}
};
int main(){
MyClass * pt = new MyClass[3];
return 0;
}.
Answer: delete [ ] pt;
◉ The semantic structure of imperative programming languages
normally include which of the following validations
,parameters type in a function declaration should match these in the
function call.
division by zero
statement should end with a ';'
unicity
a variable name should start with a letter, '$' or '_'
type matching.
Answer: parameters type in a function declaration should match
these in the function call.
unicity
type matching
◉ The syntactical structure of the imperative programming
language reviewed in this course include which of the following
validations
, unicity
statement should end with a ';'
type matching
a variable name should start with a letter, '$' or '_'
division by zero
parameters type in a function declaration should match these in the
function call..
Answer: statement should end with a ';'
◉ Running the following program,
How many times the message "constructing" is printed on the
screen?
#include<iostream>
using namespace std;
class Rectangle {