Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 4 fuera de 194 páginas
Examen

Code: AC11 Subject: OBJECT ORIENTED PROGRAMMING

Document preview thumbnail
Vista previa 4 fuera de 194 páginas

Each Question carries 2 marks. Choose correct or the best alternative in the following: Q.1 The address of a variable temp of type float is (A) *temp (B) &temp (C) float& temp (D) float temp& Ans: B Q.2 What is the output of the following code char symbol[3]={‘a’,‘b’,‘c’}; for (int index=0; index3; index++) cout symbol [index]; (A) a b c (B) “abc” (C) abc (D) ‘abc’ Ans: C Q.3 The process of building new classes from existing one is called ______. (A) Polymorphism (B) Structure (C) Inheritance (D) Cascading Ans: C Q.4 If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access (A) protected and public data only in C and B. (B) protected and public data only in C. (C) private data in A and B. (D) protected data in A and B. Ans: D Q.5 If the variable count exceeds 100, a single statement that prints “Too many” is (A) if (count100) cout “Too many”; (B) if (count100) cout “Too many”; (C) if (count100) cout “Too many”; (D) None of these. 2 Code: AC11 Subject: OBJECT ORIENTED PROGRAMMING Ans: C Q.6 Usually a pure virtual function (A) has complete function body. (B) will never be called. (C) will be called only to delete an object. (D) is defined only in derived class. Ans: D Q.7 To perform stream I/O with disk files in C++, you should (A) open and close files as in procedural languages. (B) use classes derived from ios. (C) use C language library functions to read and write data. (D) include the IOSTREAM.H header file. Ans: B Q.8 Overloading the function operator (A) requires a class with an overloaded operator. (B) requires a class with an overloaded [ ] operator. (C) allows you to create objects that act syntactically like functions. (D) usually make use of a constructo

Vista previa del contenido

Code: AC11 Subject: OBJECT ORIENTED PROGRAMMING
PART - I, VOL – I

TYPICAL QUESTIONS & ANSWERS

OBJECTIVE TYPE QUESTIONS


Each Question carries 2 marks.

Choose correct or the best alternative in the following:

Q.1 The address of a variable temp of type float is
(A) *temp (B) &temp
(C) float& temp (D) float temp&

Ans: B

Q.2 What is the output of the following code
char symbol[3]={‘a’,‘b’,‘c’};
for (int index=0; index<3; index++)
cout << symbol [index];
(A) a b c (B) “abc”
(C) abc (D) ‘abc’

Ans: C

Q.3 The process of building new classes from existing one is called ______.
(A) Polymorphism (B) Structure
(C) Inheritance (D) Cascading

Ans: C

Q.4 If a class C is derived from class B, which is derived from class A, all through public
inheritance, then a class C member function can access
(A) protected and public data only in C and B.
(B) protected and public data only in C.
(C) private data in A and B.
(D) protected data in A and B.

Ans: D

Q.5 If the variable count exceeds 100, a single statement that prints “Too many” is
(A) if (count<100) cout << “Too many”;
(B) if (count>100) cout >> “Too many”;
(C) if (count>100) cout << “Too many”;
(D) None of these.
1

,Code: AC11 Subject: OBJECT ORIENTED PROGRAMMING


Ans: C

Q.6 Usually a pure virtual function
(A) has complete function body.
(B) will never be called.
(C) will be called only to delete an object.
(D) is defined only in derived class.

Ans: D

Q.7 To perform stream I/O with disk files in C++, you should
(A) open and close files as in procedural languages.
(B) use classes derived from ios.
(C) use C language library functions to read and write data.
(D) include the IOSTREAM.H header file.

Ans: B

Q.8 Overloading the function operator
(A) requires a class with an overloaded operator.
(B) requires a class with an overloaded [ ] operator.
(C) allows you to create objects that act syntactically like functions.
(D) usually make use of a constructor that takes arguments.

Ans: A

Q.9 In C++, the range of signed integer type variable is ________
(A) 0 to 216 (B) − 215 to 215 − 1
(C) − 2 7 to 2 7 − 1 (D) 0 to 2 8

Ans: B

Q.10 If x = 5, y = 2 then x ∧ y equals________.
(where ∧ is a bitwise XOR operator)
(A) 00000111 (B) 10000010
(C) 10100000 (D) 11001000

Ans: A

Q.11 If an array is declared as
int a[4] = {3, 0, 1, 2}, then values assigned to a[0] & a[4] will be ________
(A) 3, 2 (B) 0, 2
(C) 3, 0 (D) 0, 4

Ans: C

2

,Code: AC11 Subject: OBJECT ORIENTED PROGRAMMING


Q.12 Mechanism of deriving a class from another derived class is known as____
(A) Polymorphism (B) Single Inheritance
(C) Multilevel Inheritance (D) Message Passing

Ans: C

Q.13 RunTime Polymorphism is achieved by ______
(A) friend function (B) virtual function
(C) operator overloading (D) function overloading

Ans: B

Q.14 A function call mechanism that passes arguments to a function by passing a copy of the values
of the arguments is __________
(A) call by name (B) call by value
(C) call by reference (D) call by value result

Ans: B

Q.15 In C++, dynamic memory allocation is accomplished with the operator ____
(A) new (B) this
(C) malloc( ) (D) delete

Ans: A

Q.16 If we create a file by ‘ifstream’, then the default mode of the file is _________
(A) ios :: out (B) ios :: in
(C) ios :: app (D) ios :: binary

Ans: B

Q.17 A variable defined within a block is visible
(A) from the point of definition onward in the program.
(B) from the point of definition onward in the function.
(C) from the point of definition onward in the block.
(D) throughout the function.

Ans: C

Q.18 The break statement causes an exit
(A) from the innermost loop only. (B) only from the innermost switch.
(C) from all loops & switches. (D) from the innermost loop or switch.

Ans: D

Q.19 Which of the following cannot be legitimately passed to a function
3

, Code: AC11 Subject: OBJECT ORIENTED PROGRAMMING

(A) A constant. (B) A variable.
(C) A structure. (D) A header file.

Ans: D

Q.20 A property which is not true for classes is that they
(A) are removed from memory when not in use.
(B) permit data to be hidden from other classes.
(C) bring together all aspects of an entity in one place.
(D) Can closely model objects in the real world.

Ans: C

Q.21 You can read input that consists of multiple lines of text using
(A) the normal cout << combination.
(B) the cin.get( ) function with one argument.
(C) the cin.get( ) function with two arguments.
(D) the cin.get( ) function with three arguments.

Ans: C

Q.22 The keyword friend does not appear in
(A) the class allowing access to another class.
(B) the class desiring access to another class.
(C) the private section of a class.
(D) the public section of a class.

Ans: C

Q.23 The process of building new classes from existing one is called
(A) Structure. (B) Inheritance.
(C) Polymorphism. (D) Template.

Ans: B

Q.24 If you wanted to sort many large objects or structures, it would be most efficient to

(A) place them in an array & sort the array.
(B) place pointers to them in an array & sort the array.
(C) place them in a linked list and sort the linked list.
(D) place references to them in an array and sort the array.

Ans: C

Q.25 Which statement gets affected when i++ is changed to ++i?
(A) i = 20; i++;
(B) for (i = 0; i<20; i++) { }
4

Información del documento

Subido en
10 de agosto de 2024
Número de páginas
194
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$18.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
StudyCenter1
4.3
(29)
Vendido
232
Seguidores
91
Artículos
3849
Última venta
4 días hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes