CS15M2B Exam
CS15M2B Exam
EWSU WalterSISUUVrm
FINAL EXAMINATION
DURATION 3 HOURS
TOTAL MARKS 100
INSTRUCTIONS
1. THIS IS ACLOSED-BOOK EXAMINATION.
2, USE THE ANSWER BOOKS PROVIDED TO ANSWER ALL QUESTIONS. FILL IN
YOUR DETAILS ON THE COVER PAGE OF YOUR ANSWER BOOK.
3. WRITE LEGIBLY AND NEATLY.
4. ANSWER ALL QUESTIONS.
5. READ QUESTIONS CAREFULLY ANDANSWER ONLY WHAT ISASKED.
6. GENERAL WALTER SISULU UNIVERSITY POLICIES, PROCEDURES, AND RULES
PERTAINING TO WRITTEN ASSESSMENTS APPLY TO THIS EXAMINATION.
Intro to Object-oriented
DIPLOMA AND DEGREE EXAMINATION 2023 CS15M2B:
Programming FINAL Examination I NOV/DEC
QUESTION 1 [14]
1. In C++, what is a
class?
A. An instance of an
object.
B. A
blueprint for creating
objects.
C. A function that
initializes objects.
D. An array of data.
whlch access specifier in C++ alaue class members to be accessed only
withinthe same class?
A. public
B. private
C. protected
D. internal
3. What is the purpose of a constructor in a C++ class?
To destroy objects.
A.
B. To create objects.
C. To declare class variables.
7. Which header file should be included to work with input and output streams
in C++?
A. <iostream>
B. <fstream>
C. <iomanip>
D. <string>
8. In C++,what is inheritance?
A.A mechanism for hiding data members.
B.A way to define new data types.
C. A process of creating a copy of an obJeCt.
D. A mechanism for creating a new class based on an existing class.
program?[9]
following
the
What
of
the
output
code.[4] Explain
is
2.
happen?
object,
Student
on
based
attempt
wll
what
GPA
Tor
4.5
the set
you
of
to
a
If
a
student1?[2]
obiect Student
function
named
displayIno(0
How
for
class? Student
call
the
you
purpose
would
a
provided
[21
what
the
of
is
the
code,
In
e. d.C.
the you
your
how
do
code?
GPA
[41
3.5,
in
it
and
of
"Alice,"
would
object
Student
a
create
20.
age
name
with
the
new
you
want
to
If
a
b.
object? Student
called
display
for
when
function member
[4]
a
displayInfo()
does
What
it
work?
How
does
the
a.
code:
following
Consider
the
1.
QUESTION
[25]
2
struct.
member
array
of
can
be
a
An
operatorl.J.
using accessed
member struct
the
by
ais
E.D.
class.
members
private access directly derived
ofa
base
the
can
class
C.
reference.
value either function parameter passed class
by
to
can
A A by A
or
be
as
B.
a
a
#include.
directive pre-proceSSor
Header
using
CPP
added
are
file
into
false()
true(T) statements
a
following
whether
are
|1"5]
aor
filesthe
operations.
10.
Bitwise
0bjects. pointers
access Member
to
for
pointer.
Dereferencing
a
arithmetic.
Pointer
represent?
primarily
operator
A. State D.C. B. A.
arrow
->
the
does
what
C++,
In
9.
Examination
FINAL
Programming
Object-oriented Intro CS15M2B:
NOV/DEC
EXAMINATION DEGREE DIPLOMA
to
2023
AND
I
class.
integrity
maintaining
32
within
role
programming
data
object-oriented
in
[3]
its
information
concept
Discuss
and
hiding
ain
of
the
example
Provide
inC++?
abstract
[4]
ADT
of
an
an
type
data
members.
(ADT)
What
an
accessibility
visibility
is
control
classes
of
class
and
the
protected)
private,
C++
public, (e.g.,
to
specifiers
access
Explain
used
are
[6]in
how
systems.
programming
object-oriented
applications
real-world
[3]
of
two
programming.
Give
object-oriented
any
advantages
[2]
of
header
two
any
library
List
standard
commonly
examples
(5]
least
files
used
Provide
at
programs.
C++
3.
header
including
purpose
Describe
C++
in
files
operator.
of the
resolution
two
[2]
uses
of
of scope
Give
a
7. 6. 5. 4.3. 2.1.
Question
[25]
3
end1;
tOJte
ta
y
213
aint)t
Examination
Programming
Object-oriented
Intro
FINAL
CS15M2B:
EXAMINATION|
DEGREE
to
DIPLOMA
2023
AND
NOV/DEC.
|
DIPLOMA AND DEGREE
Programming FINAL EXAMINATION
Examination
| NOV/DEC 2023
CS15M2B: Introto
Object-oriented
QUESTION 4 [36
1. Consider
the following:
class
BankAccount
private:
int
acc_number;
double balance;
public:
void open(int
num);
void deposit();
void
withdraw();
double getBalance();
Prruett,
nç Oceunt