100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSE 240 Final Exam | Verified with 100% Correct Answers $19.99
Add to cart

Exam (elaborations)

CSE 240 Final Exam | Verified with 100% Correct Answers

 0 purchase
  • Course
  • CSE 240
  • Institution
  • CSE 240

CSE 240 Final Exam | Verified with 100% Correct 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; } 41 What is the value in the variable Exam::total that is printed when this program is execute...

[Show more]

Preview 3 out of 26  pages

  • March 9, 2025
  • 26
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CSE 240
  • CSE 240
avatar-seller
NurseHenny
CSE 240 Final Exam



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;
}
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;
}
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;
}
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

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.

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;
}
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

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
class Person {
public:
Person() {
//code
}
Person(char* lName, int year) {
// code
}
private:
char* lastName;
int yearOfBirth;
};

class Student : public Person {
public:
Student() {
//code
}
Student(char n, int y, char u):Person(n, y) {
//code
}
private:

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller NurseHenny. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $19.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

71241 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 15 years now

Start selling
$19.99
  • (0)
Add to cart
Added