[CP 2] M8 - Introduction to OOP

studied byStudied by 1 person
0.0(0)
Get a hint
Hint

code must contain at least one class

1 / 49

flashcard set

Earn XP

Description and Tags

50 Terms

1

code must contain at least one class

Which concept of OOP is false for C++?

New cards
2

C++

Which of the following is an OOP language?

New cards
3

Member Functions

What is the additional feature in classes that were not in structures?

New cards
4

dot (.) operator

What operator is used to access a data member or a member function?

New cards
5

As many as you want

How many classes can be defined in a single program?

New cards
6

Blueprint of an object

Which of the following best defines a class?

New cards
7

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++?

New cards
8

Error

What is the output of the given program?

\#include <iostream\>

using namespace std;

class Test {

int x;

};

int main()

{

Test t;

cout << t.x;

return 0;

}
New cards
9

::

What symbol is used to define a function outside of the class?

New cards
10

Car SportsCar;

If a class is named Car and you will create an object named SportsCar, what would be the statement?

New cards
11

A class has a default privacy specification of private(?)

What is the difference between a struct and a class in C++?

New cards
12

an instance

An object is a _________________ of a class

New cards
13

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.

New cards
14

header file

Which of the following cannot be passed to a function in C++?

New cards
15

class

It refers to the blueprint of an object:

New cards
16

idk

What is the output of this program?

class Test {

int x;

};

int main()

{

Test t;

cout << t.x;

return 0;

}

New cards
17

member functions

A Function that has its definition or its prototype within the class definition like any other variable.

New cards
18

error

class Test {

int x;

};

int main()

{

Test t;

cout << t.x;

return 0;

}

New cards
19

error

What is the output of the given program?

\#include <iostream\>

using namespace std;

class Test {

int x;

};

int main()

{

Test t;

cout << t.x;

return 0;

What is the output of the given program?

\#include <iostream\>

using namespace std;

class Test {

int x;

};

int main()

{

Test t;

cout << t.x;

return 0;

}
New cards
20

encapsulation

Which of the following concepts of OOPS means exposing only necessary information to the client?

Encapsulation

Abstraction

Data binding

Data hiding

New cards
21

instance

An object is a _________________ of a class

New cards
22

<<

Which of the following operator is used for cout?

New cards
23

>>

Which of the following operator is used for cin?

New cards
24

which of te following is a valid class declaration?

class A { int x; };

instance of objects

New cards
25

Pick out the other definition of objects.

class

New cards
26

Blueprint of an object

Duplicate/Redundant Data

New cards
27

Which is not a feature of OOP in general definitions?

Code reusability

Modularity

Duplicate/Redundant Data

Efficient code

object

New cards
28

It is an identifiable entity with some characteristics and behavior

class Student {};

New cards
29

Which of the following has a correct C++ class definition?

class Student;

class Student {}:

class Student {};

class Student ()

C++

New cards
30

Which of the following is an OOP language?

C++ HTML BASIC

Student firstyear

New cards
31

If there is a class named Student and you want to create an object name "firstyear", what would be the correct syntax

method

New cards
32

A behavior an object

encapsulation

New cards
33

Refers to binding together the data and the functions that manipulate them

Apple.price = 15;

New cards
34

If an object named Apple has a member named "price", what is the command to assign a value of 15 into it?

member function

New cards
35

Which of the following term is used for a function defined inside a class?

Member Variable

Class function

Classic function

Member function

class

New cards
36

Which of the following is an abstract data type? Group of answer choices

int

string

double

class

protected data members

New cards
37

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

New cards
38

What is the difference between a struct and a class in C++?

car SportsCar;

New cards
39

If a class is named Car and you will create an object named SportsCar, what would be the statement?

Fruits Apple;

New cards
40

If a class is named Fruits and you will create an object named Apple, what would be the statement?

encapsulation

New cards
41

Which of the following concepts means wrapping up of data and functions together? Group of answer choices

Inheritance

Abstraction

Encapsulation

Object

header file

New cards
42

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.

New cards
43

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

New cards
44
What is the output of the given program?

\#include<iostream\>

using namespace std;

main() {

class student {

int rno \= 10;

} v;



cout<<v.rno;

}

data and functions

New cards
45

a class can hold ______

class

New cards
46

Objects created are based on what?

Code must contain at least one class

New cards
47

Which concept of OOP is false for C++?

private

New cards
48

The default access specifier for the class members is:

Box.length = 5;

New cards
49

If an object named Box has a member of length, what is the command to assign a value of 5 into it?

Header file

New cards
50

Which of the following cannot be passed to a function in C++ ?

New cards

Explore top notes

note Note
studied byStudied by 28 people
... ago
5.0(2)
note Note
studied byStudied by 75 people
... ago
5.0(1)
note Note
studied byStudied by 5 people
... ago
5.0(1)
note Note
studied byStudied by 34 people
... ago
5.0(1)
note Note
studied byStudied by 9 people
... ago
5.0(1)
note Note
studied byStudied by 23 people
... ago
5.0(2)
note Note
studied byStudied by 5044 people
... ago
4.3(14)

Explore top flashcards

flashcards Flashcard (90)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (67)
studied byStudied by 9 people
... ago
5.0(1)
flashcards Flashcard (95)
studied byStudied by 258 people
... ago
5.0(5)
flashcards Flashcard (44)
studied byStudied by 12 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 41 people
... ago
5.0(1)
flashcards Flashcard (104)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (127)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (43)
studied byStudied by 690 people
... ago
5.0(2)
robot