100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CSE 240 FINAL QUESTIONS & ANSWERS

Rating
-
Sold
-
Pages
27
Grade
A+
Uploaded on
18-06-2025
Written in
2024/2025

CSE 240 FINAL QUESTIONS & ANSWERS

Institution
CSE 240
Course
CSE 240










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CSE 240
Course
CSE 240

Document information

Uploaded on
June 18, 2025
Number of pages
27
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

CSE 240 FINAL QUESTIONS & ANSWERS
What is printed by the following code?
int main () {
int array[5] = {10,30,50,70,90};
int *p = array;
cout << *(p+1) + *(&*p) + 1; return 0;
} - Answers :41

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;
} - Answers :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;
} - Answers :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 - Answers :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. -
Answers :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 {
public:
Rectangle(){
cout <<"constructing"<<endl;
}
~Rectangle()

, {cout <<"destructing"<<endl;
}
};
class Box : public Rectangle {
public:
Box(){
cout <<"constructing"<<endl;
}
~Box()
{cout <<"destructing"<<endl;
}
};

int main(){
Box * a = new Box[5];
delete[] a;
return 0;
} - Answers :10

Features of the logic paradigm includes

expressing computation in terms of logic predicates

using lambda calculus

classes and objects

expressing computation in terms of boolean expressions - Answers :expressing
computation in terms of logic predicates

Which of the following options is the code in C++ for
A class Student that inherits from a class Person.
A constructor in Student that calls (is able to call) a constructor in Person
When the body of the method is not relevant to answer the question, it has been
replaced for a comment // code - Answers :class Person {
public:
Person() {
//code
}
Person(char* lName, int year) {
// code
}
private:
char* lastName;
int yearOfBirth;
};

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Greaterheights Birkbeck, University of London
View profile
Follow You need to be logged in order to follow users or courses
Sold
1120
Member since
3 year
Number of followers
880
Documents
18226
Last sold
1 day ago

4.0

210 reviews

5
114
4
41
3
24
2
10
1
21

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions