[CP 2] M8 - Introduction to OOP

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/49

flashcard set

Earn XP

Description and Tags

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

50 Terms

1
New cards
code must contain at least one class
Which concept of OOP is false for C++?
2
New cards
C++
Which of the following is an OOP language?
3
New cards
Member Functions
What is the additional feature in classes that were not in structures?
4
New cards
dot (.) operator
What operator is used to access a data member or a member function?
5
New cards
As many as you want
How many classes can be defined in a single program?
6
New cards
Blueprint of an object
Which of the following best defines a class?
7
New cards
Members of a class are private by default and members of struct are public by default.
What is the difference between struct and class in C++?
8
New cards
Error
What is the output of the given program?

\#include
9
New cards
::
What symbol is used to define a function outside of the class?
10
New cards
Car SportsCar;
If a class is named Car and you will create an object named SportsCar, what would be the statement?
11
New cards
A class has a default privacy specification of private(?)
What is the difference between a struct and a class in C++?
12
New cards
an instance
An object is a \_________________ of a class
13
New cards
Structures can have functions as members
Which of the following statements is correct in C++?


Structure members are private by default

Structures can have functions as members

Classes cannot have data as protected members.

Class members are public by default.
14
New cards
header file
Which of the following cannot be passed to a function in C++?
15
New cards
class
It refers to the blueprint of an object:
16
New cards
idk
What is the output of this program?

class Test {

int x;

};

int main()

{

Test t;

cout << t.x;

return 0;

}
17
New cards
member functions
A Function that has its definition or its prototype within the class definition like any other variable.
18
New cards
error
class Test {

int x;

};

int main()

{

Test t;

cout << t.x;

return 0;

}
19
New cards
error
What is the output of the given program?

\#include
20
New cards
encapsulation
Which of the following concepts of OOPS means exposing only necessary information to the client?


Encapsulation

Abstraction

Data binding

Data hiding
21
New cards
instance
An object is a \_________________ of a class
22
New cards
<<
Which of the following operator is used for cout?
23
New cards
\>>
Which of the following operator is used for cin?
24
New cards
which of te following is a valid class declaration?

class A { int x; };
instance of objects
25
New cards
Pick out the other definition of objects.
class
26
New cards
Blueprint of an object
Duplicate/Redundant Data
27
New cards
Which is not a feature of OOP in general definitions?


Code reusability

Modularity

Duplicate/Redundant Data

Efficient code
object
28
New cards
It is an identifiable entity with some characteristics and behavior
class Student {};
29
New cards
Which of the following has a correct C++ class definition?

class Student;

class Student {}:

class Student {};

class Student ()
C++
30
New cards
Which of the following is an OOP language?

C++
HTML
BASIC
Student firstyear
31
New cards
If there is a class named Student and you want to create an object name "firstyear", what would be the correct syntax
method
32
New cards
A behavior an object
encapsulation
33
New cards
Refers to binding together the data and the functions that manipulate them
Apple.price \= 15;
34
New cards
If an object named Apple has a member named "price", what is the command to assign a value of 15 into it?
member function
35
New cards
Which of the following term is used for a function defined inside a class?

Member Variable

Class function

Classic function

Member function
class
36
New cards
Which of the following is an abstract data type?
Group of answer choices

int

string

double

class
protected data members
37
New cards
Which of the following are available only in the class hierarchy chain?
Group of answer choices

Public data members

Private data members

Member functions

Protected data members
A class has a default accesibility private
38
New cards
What is the difference between a struct and a class in C++?
car SportsCar;
39
New cards
If a class is named Car and you will create an object named SportsCar, what would be the statement?
Fruits Apple;
40
New cards
If a class is named Fruits and you will create an object named Apple, what would be the statement?
encapsulation
41
New cards
Which of the following concepts means wrapping up of data and functions together?
Group of answer choices

Inheritance

Abstraction

Encapsulation

Object
header file
42
New cards
Which of the following cannot be passed to a function in C++?
Group of answer choices

structure

array

constant

header file
class data members are private by default while that of structure are public by default.
43
New cards
Which of the following is correct about class and structure?
Group of answer choices

class data members are public by default while that of structure are private.

Pointer to structure or classes cannot be declared.

class data members are private by default while that of structure are public by default.

class can have member functions while structure cannot
error
44
New cards
What is the output of the given program?

\#include
data and functions
45
New cards
a class can hold \______
class
46
New cards
Objects created are based on what?
Code must contain at least one class
47
New cards
Which concept of OOP is false for C++?
private
48
New cards
The default access specifier for the class members is:
Box.length \= 5;
49
New cards
If an object named Box has a member of length, what is the command to assign a value of 5 into it?
Header file
50
New cards
Which of the following cannot be passed to a function in C++ ?