Question
Object
Class
Methods
Properties
click below
click below
Question
class
Property
Method
Abstract
Normal Size Small Size show me how
CP2
Formative Assessment 8
Question | Answer |
---|---|
It is an identifiable entity with some characteristics and behavior Object Class Methods Properties | Object |
A behavior an object class Property Method Abstract | Method |
If there is a class named Student and you want to create an object name "firstyear", what would be the correct syntax Student firstyear student first year; student firstyear() student firstyear | Student firstyear |
Blueprint of an object Inheritance Data Members Object Class | Class |
Which of the following is an OOP language? BASIC C++ HTML C | C++ |
Refers to binding together the data and the functions that manipulate them Objects Class Abstraction Encapsulation | Encapsulation |
Which of the following cannot be passed to a function in C++ ? Header file Constant Structure Array | Header file |
Which is not a feature of OOP in general definitions? Duplicate/Redundant Data Modularity Code reusability Efficient code | Duplicate/Redundant Data |
What operator is used to access a data member or a member function? == operator & operator + operator dot (.) operator | dot (.) operator |
Pick out the other definition of objects. member of the class instance of the class associate of the class attribute of the class | instance of the class |
class Test { int x; }; int main() { Test t; cout << t.x; return 0; } 0 -1 Garbage value Error | Error |
Which of the following operator is used for cout? << >> + = | << |
It refers to the blueprint of an object: Data Access Modifier Class Inheritance | Class |
What is the difference between a struct and a class in C++? A class has a default privacy specification of public. A struct cannot have member functions A struct cannot have private members. A class has a default privacy specification of private | A class has a default privacy specification of private |
Which of the following concepts of OOPS means exposing only necessary information to the client? Data hiding Encapsulation Data binding Abstraction | Abstraction |
If a class is named Fruits and you will create an object named Apple, what would be the statement? Fruits(Apple); Apple Fruits; Apple@Fruits; Fruits Apple; | Fruits Apple; |
What symbol is used to define a function outside of the class? :: <> : & | :: |
Which of the following statements is correct in C++? Class members are public by default. Structures can have functions as members Classes cannot have data as protected members. Structure members are private by default | Structures can have functions as members |
If an object named Box has a member of length, what is the command to assign a value of 5 into it? Box.length = 5; Length = 5; Box.length == 5; Box(5) | Box.length = 5; |
If a class is named Car and you will create an object named SportsCar, what would be the statement? Car<SportsCar>; SportsCar Car; Car (SportsCar); Car SportsCar; | Car SportsCar; |
Which concept of OOP is false for C++? A class must have member functions Code must contain at least one class At least one object should be declared in code Code can be written without using classes | A class must have member functions |
#include <iostream> using namespace std; class Test { int x; }; int main() { Test t; cout << t.x; return 0; } Error 1 Garbage value 0 | Error |
How many classes can be defined in a single program? Only 999 Only 100 As many as you want Only 1 | As many as you want |
#include<iostream> using namespace std; main() { class student { int rno = 10; } v; cout<<v.rno; } 10 Garbage value Error 0 | Error |
The default access specifier for the class members is: none of the given private protected public | private |
Which of the following concepts means wrapping up of data and functions together? Inheritance Object Encapsulation Abstraction | Encapsulation |
If an object named Apple has a member named "price", what is the command to assign a value of 15 into it? Price(15); Apple.price = 15; Apple(15); Apple.price == 15; | Apple.price = 15; |
class Test { int x; }; int main() { Test t; cout << t.x; return 0; } -1 0 Garbage value Error | Error |
An object is a _________________ of a class an encapsulation an instance a member function an interface | an instance |
It means displaying only essential information and hiding the details. Object Class Abstraction Methods | Abstraction |
#include <iostream> using namespace std; class Test { int x; }; int main() { Test t; cout << t.x; return 0; } Error 1 Garbage value 0 | Error |
Which of the following best defines a class? Parent of an object Instance of an object Scope of an object Blueprint of an object | Blueprint of an object |
Which of the following term is used for a function defined inside a class? Member Variable Member function Classic function Class function | Member function |
What is the additional feature in classes that were not in structures? Static data allowed Public access specifier Data members Member Functions | Member Functions |
Which of the following has a correct C++ class definition? class Student {}; class Student; class Student {}: class Student () | class Student {}; |
Objects created are based on what? class behavior abstract attributes | class |
A Function that has its definition or its prototype within the class definition like any other variable. Objects Class Member Functions Data Member | Member Functions |
Which of the following are available only in the class hierarchy chain? Private data members Member functions Protected data members Public data members | Public data members |
Which of the following is an abstract data type? double string class int | class |
#include<iostream> using namespace std; main() { class student { int rno = 10; } v; cout<<v.rno; } Garbage value 10 0 Error | Error |
#include <iostream> using namespace std; class Test { int x; }; int main() { Test t; cout << t.x; return 0; } 1 0 Error Garbage value | Garbage value |
class Test { int x; }; int main() { Test t; cout << t.x; return 0; } Error -1 Garbage value 0 | Garbage value |