Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

CS3307 EXAM QUESTIONS WITH CORRECT SOLUTIONS||100% GUARANTEED PASS||UPDATED 2026/2027 SYLLABUS||NEWEST VERSION

Rating
-
Sold
-
Pages
88
Grade
A+
Uploaded on
03-04-2026
Written in
2025/2026

CS3307 EXAM QUESTIONS WITH CORRECT SOLUTIONS||100% GUARANTEED PASS||UPDATED 2026/2027 SYLLABUS||NEWEST VERSION How can you specify which constructor to call in a derived classes constructor? - ANSWER By appending the child constructor with colon and the specific parent constructor. e.g. Child::Child(int x) : Parent(x) {...} How is multiple inheritance instantiated? - ANSWER By including more than one inherited class after the : in the derived class definition. e.g. class Mustang: public Car, public SportsCar, public Ford {... }; What does a friend mean to C++? - ANSWER A friend is a function that can use the private and protected members of a class. However friendship in C++ is one-way. Of course, we all have a friend or two like that!!! So if you want it two-way you must declare it. It is also not transitive. My friends are not your friends, and your friends are not my friends. usage friend class MyClass; What is a friend function? - ANSWER By including the friend keyword functions external to the class can appear as member functions. What are function templates - ANSWER Generic programming allows for one class to handle multiple types. e.g. tempate typename T T max(T a, T b) { if (ab) return a; else return b; } What is a class tempate? - ANSWER A form of generic declaration of a class. #includeiostream using namespace std; template class T class calc { public: T multiply(T x, T y); T add(T x, T y); }; template class T T calcT::multiply(T x, T y) { return x*y; } template class T T calcT::add(T x, T y) { return x+y; } int main() { calcint c; cout (10,20) endl; } What kinds of things can you find in the standard template library? - ANSWER Containers, algorithms and iterators oh my!

Show more Read less
Institution
CS3307
Course
CS3307

Content preview

CS3307 EXAM QUESTIONS WITH
CORRECT SOLUTIONS||100%
GUARANTEED PASS||UPDATED
2026/2027 SYLLABUS||<<NEWEST
VERSION>>

How can you specify which constructor to call in a derived classes constructor? -
ANSWER ✓ By appending the child constructor with colon and the specific
parent constructor.

e.g. Child::Child(int x) : Parent(x) {...}

How is multiple inheritance instantiated? - ANSWER ✓ By including more than
one inherited class after the : in the derived class definition.

e.g. class Mustang: public Car, public SportsCar, public Ford
{...
};

What does a friend mean to C++? - ANSWER ✓ A friend is a function that can
use the private and protected members of a class.

However friendship in C++ is one-way. Of course, we all have a friend or two like
that!!!

So if you want it two-way you must declare it. It is also not transitive.

My friends are not your friends, and your friends are not my friends.

usage friend class MyClass;

What is a friend function? - ANSWER ✓ By including the friend keyword
functions external to the class can appear as member functions.

, What are function templates - ANSWER ✓ Generic programming allows for one
class to handle multiple types.


e.g.

tempate <typename T>
T max(T a, T b)
{
if (a>b)
return a;
else
return b;
}

What is a class tempate? - ANSWER ✓ A form of generic declaration of a class.

#include<iostream>
using namespace std;

template <class T> class calc
{
public:
T multiply(T x, T y);
T add(T x, T y);
};

template <class T> T calc<T>::multiply(T x, T y) {
return x*y;
}

template <class T> T calc<T>::add(T x, T y) {
return x+y;
}

int main() {
calc<int> c;
cout << c.add(10,20) << endl;

,}

What kinds of things can you find in the standard template library? - ANSWER ✓
Containers, algorithms and iterators oh my!

What is overloading - ANSWER ✓ It allows you to have more than one definition
for a function or operator in the same scope.

If they have the same name they will have different arguments and
implementations.

Compiler determines appropriate one based on args.

This extends to member functions.

It cannot only differ by return.

Example of << operator overloaded to create a toString style method - ANSWER
✓ friend ostream& operator<<(ostream& os, const Rectangle& rect);
};

ostream& operator<<(ostream& os, const Rectangle& rect) {
os << rect.width << "x" << rect.height;
return os;
}

Can operators be overloaded? - ANSWER ✓ Most of the built-in operators can be
overridden.

For example you can define a concatenation using + for two strings, however the
use of overrides can lead to confusing code if overused or used improperly.

What is polymorphism in C? - ANSWER ✓ In C++, we are usually referring to
sub-type polymorphism, in which we can make use of derived classes through base
class pointers and references

Generally this occurs when a pointer to the parent type is called against a derived
object.

, e.g.

int main() {
Person *p;
Student *s = new Student();

s->sayHello();
p = s;
p->sayHello();
}

How does the virtual keyword affect polymorphism? - ANSWER ✓ It enables
dynamic dispatching.

virtual is expressed in the header and a method declared virtual will stay virtual in
all descendant classes.

virtual should be placed on a parent class function which is expected to be
overridden.

virtual methods can also be left unimplemented, this is called abstract in other
languages.

This forces subclasses to implement.

e.g. virtual void sayHello() = 0;

Can a class containing pure virtual (abstract) methods be instantiated? - ANSWER
✓ No they serve as a base class for other methods.

Derived classes are only instantiatable if all virtual methods are implemented.

Why is the this keyword used? - ANSWER ✓ It is a pointer that refers to the
current object to self reference. It makes code more readable.

What is a static member? - ANSWER ✓ A static member belongs to the class, not
an instance. They do not require instantiation of an object before using.

Written for

Institution
CS3307
Course
CS3307

Document information

Uploaded on
April 3, 2026
Number of pages
88
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$14.69
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
SmartscoreAaron Chicago State University
Follow You need to be logged in order to follow users or courses
Sold
77
Member since
1 year
Number of followers
6
Documents
4072
Last sold
2 weeks ago
SMARTSCORES LIBRARY

Get top-tier academic support for Psychology, Nursing, Business, Engineering, HRM, Math, and more. Our team of professional tutors delivers high-quality homework, quiz, and exam assistance—ensuring scholarly excellence and grade-boosting results. Trust our collaborative expertise to help you succeed in any course at U.S.A Institutions.

3.1

7 reviews

5
3
4
1
3
0
2
0
1
3

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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions