Introduction to Object Oriented Programming C++ 1


SKU: AMSEQ-138 Category:

Part A


Q1. Explain briefly characteristics of OOPS language and mention advantages of OOPS approach over procedural programming language.
Q2. Give the tabular difference between structures, and classes.


Q3. What is the difference between keyword and identifier?


Q4. What is difference between fundamental and derived data types?


Q5. Differentiate between ‘call by reference’ and ‘call by value’

Part B


Q1. Write a C++ program that invoke a function calc() which intake two integer and an arithmetic operator and print the corresponding result.

Q2. Answer the questions (i) to (iii) based on the following code

class stationary
char Type;
char Manufacturer [10];
void Read_sta_details( );
void Disp_sta_details( );
class office: public stationary
int no_of_types;
float cost_of_sta;
void Read_off_details( );
void Disp_off_details( );
class printer: private office
int no_of_users;
char delivery_date[10];
void Read_pri_details( );
void Disp_pri_details( );
void main ( )
{ printer MyPrinter; }

  1. Mention the member names which are accessible by MyPrinter declared in main() function
  2. What is the size of MyPrinter in bytes?
  3. Mention the names of functions accessible from the member function
    Read_pri_details () of class printer.



Q3. Develop a Project on any one using C++ :

a. Hospital Management System

b. Railways Reservation System

c. Student Information System



Part C


Q1 Which of the following is false?

a. Cout represents the standard output stream in c++.

b. Cout is declared in the iostream standard file

c. Cout is declared within the std namespace

d. None of above


Q2. What is the only function all C++ programs must contain?

A. start()
B. system()
C. main()
D. program()


Q3. What punctuation is used to signal the beginning and end of code blocks?

A. { }
B. -> and <-
D. ( and )


Q4. What punctuation ends most lines of C++ code?

A. . (dot)
B. ; (semi-colon)
C. : (colon)
D. ‘ (single quote)


Q5. Which of the following is a correct comment?

A. */ Comments */
B. ** Comment **
C. /* Comment */
D. { Comment }


Q6. Which of the following is not a correct variable type?

A. float
B. real
C. int
D. double


Q7. Which of the following is the correct operator to compare two variables?

A. :=
B. =
C. equal
D. ==



Q8. Which of the following is true?

A. 1
B. 66
C. .1
D. -1
E. All of the above


Q9. Which of the following is the boolean operator for logical-and?

A. &
B. &&
C. |
D. |&


Q10. Evaluate !(1 && !(0 || 1)).

A. True
B. False
C. Unevaluatable


Q11. Every statement in C++ program should end with

a. A full stop (.)

b. A Comma (,)

c. A Semicolon (;)

d. A colon (:)


Q12. C++ was originally developed by

1. Nicolas Wirth

2. Donald Knuth

3. Bjarne Stroustrup

4. Ken Thompson


Q13. The standard c++ comment

1. /

2. //

3. /* and */

4. None of these


Q14. The preprocessor directive #include is required if

1. Console output is used

2. Console input is used

3. Both console input and output is used

4. None of these


Q15. The operator << is called

1. an insertion operator

2. put to operator

3. either a or b

4. None of these


Q16. The operator >> is called

1. an extraction operator

2. a get from operator

3. either a or b

4. get to operator


Q17. When a language has the capability to produce new data type, it is called

1. Extensible

2. Overloaded

3. Encapsulated

4. Reprehensible


Q18. The C++ symbol <<

1. perform the action of sending the value of expression listed as its right to the outputs strewn as the left.

2. is used to indicate the action from right to left

3. is adopted to resemble an arrow

4. All the above


Q19. What is a reference?

1. an operator

2. a reference is an alias for an object

3. used to rename an object

4. None of these


Q20. A constructor is called whenever

1. a object is declared

2. an object is used

3. a class is declared

4. a class is used


Q21. State the object oriented languages

1. C++

2. Java

3. Eiffel

4. All of the above


Q22. Overload function in C++

1. a group function with the same name

2. all have the same number and type of arguments

3. functions with same name and same number and type of arguments

4. All of the above



Q23. Operator overloading is

1. making c++ operators works with objects

2. giving new meaning to existing c++ operators

3. making new c++ operator

4. both a& b above


Q24. A constructor is called whenever

1. a object is declared

2. an object is used

3. a class is declared

4. a class is used


Q25. A class having no name

1. is not allowed

2. can’t have a constructor

3. can’t have a destructor

4. can’t be passed as an argument


Q26. The differences between constructors and destructor are

1. constructors can take arguments but destructor can’t

2. constructors can be overloaded but destructors can’t be overloaded

3. both a & b

4. None of these


Q27. A destructor takes

1. one argument

2. two arguments

3. three arguments

4. Zero arguments


Q28. Constructors are used to

1. initialize the objects

2. construct the data members

3. both a & b

4. None of these


Q29. In C++ a function contained with in a class is called

1. a member function

2. an operator

3. a class function

4. a method


Q30. The fields in a class of a c++ program are by default

1. protected

2. public

3. private

4. None


Q31. A variable is/are

a. String that varies during program execution

b. A portion of memory to store a determined value

c. Those numbers that are frequently required in programs

d. None of these


Q32. Which of the following can not be used as identifiers?

a. Letters

b. Digits

c. Underscores

d. Spaces


Q33. The difference between x and ‘x’ is

a. The first one refers to a variable whose identifier is x and the second one refers to the character constant x

b. The first one is a character constant x and second one is the string literal x

c. Both are same

d. None of above


Q34. Which of the following statement is true?

a. String Literals can extend to more than a single line of code by putting a backslash sign at the end of each unfinished line.

b. You can also concatenate several string constants separating them by one or several blank spaces, tabulators, newline or any other valid blank character

c. If we want the string literal to explicitly made of wide characters, we can precede the constant with the L prefix

d. All of above



Q35. Regarding following statement which of the statements is true?

const int pathwidth=100;

a. Declares a variable pathwidth with 100 as its initial value

b. Declares a construction pathwidth with 100 as its initial value

c. Declares a constant pathwidth whose value will be 100

d. Constructs an integer type variable with pathwidth as identifier and 100 as value


Q36. If you use same variable for two getline statements

a. Both the inputs are stored in that variable

b. The second input overwrites the first one

c. The second input attempt fails since the variable already got its value

d. You can not use same variable for two getline statements


Q37. The “return 0;” statement in main function indicates

a. The program did nothing; completed 0 tasks

b. The program worked as expected without any errors during its execution

c. not to end the program yet.

d. None of above


Q38. The size of following variable is not 4 bytes in 32 bit systems

a. int

b. long int

c. short int

d. float


Q39. Identify the correct statement regarding scope of variables

a. Global variables are declared in a separate file and accessible from any program.

b. Local variables are declared inside a function and accessible within the function only.

c. Global variables are declared inside a function and accessible from anywhere in program.

d. Local variables are declared in the main body of the program and accessible only from functions.


Q40 cin extraction stops execution as soon as it finds any blank space character

a. true

b. false