Home | | Computer Science 11th std | Choose the correct answer

Polymorphism | Computer Science - Choose the correct answer | 11th Computer Science : Chapter 15 : Polymorphism

Chapter: 11th Computer Science : Chapter 15 : Polymorphism

Choose the correct answer

Multiple choice questions with answers / choose the correct answer with answers - Computer Science Book back 1 mark questions and answers - Computer Science : Object Oriented Programming with C++: Polymorphism

Object Oriented Programming with C++

Polymorphism

Evaluation

 

Choose the correct answers

 

1. Which of the following refers to a function having more than one distinct meaning?

(A) Function Overloading

(B) Member overloading

(C) Operator overloading

(D) Operations overloading

 

2. Which of the following reduces the number of comparisons in a program ?

(A) Operator overloading

(B) Operations overloading

(C) Function Overloading

(D) Member overloading

 

3. void dispchar(char ch=’$’,int size=10)

{

for(int i=1;i<=size;i++)

cout<<ch;

}

How will you invoke the function dispchar() for the following input?

To print $ for 10 times

(A) dispchar();

(B) dispchar(ch,size);

(C) dispchar($,10);

(D)dispchar(‘$’,10 times);

 

4. Which of the following is not true with respect to function overloading?

(A) The overloaded functions must differ in their signature.

(B) The return type is also considered for overloading a function.

(C) The default arguments of overloaded functions are notconsidered for Overloading.

(D) Destructor function cannot be overloaded.

 

5. Which of the following is invalid prototype for function overloading

(A) void fun (intx);

void fun (char ch) ;

(B) void fun (intx);

void fun (inty);

(C) void fun (double d);

void fun (char ch);

(D) void fun (double d);

void fun (inty);

 

6. Which of the following function(s) combination cannot be considered as

overloaded function(s) in the given snippet ?

void print(char A,int B); // F1

void printprint(int A, float B); // F2

void Print(int P=10); // F3

void print(); // F4

(A) F1,F2,F3,F4

(B) F1,F2,F3

(C) F1,F2,F4

(D) F1,F3,F4

 

7. Which of the following operator is by default overloaded by the compiler?

(A) *

(B) +

(C) +=

(D) ==

(E) =

 

Based on the following program answer the questions (8) to (10)

#include<iostream>

using namespace std;

class Point {

private:

int x, y;

public:

Point(int x1,int y1)

{

x=x1;y=y1;

}

void operator+(Point &pt3);

void show() {cout << "x = " << x << ", y = " << y; } };

void Point::operator+(Point &pt3)

{

x += pt3.x;

y += pt3.y;

}

int main()

{

Point pt1(3,2),pt2(5,4);

pt1+pt2;

pt1.show();

return 0;

}

 

8. Which of the following operator is overloaded?

(A) +

(B) operator

(C) ::

(D) =

 

9. Which of the following statement invoke operator overloading?

(A) pt1+pt2;

(B) Point pt1(3,2),pt2(5,4);

(C) pt1.show();

(D) return 0;

 

10. What is the output for the above program?

(A) x=8, y=6

(B) x=14, y=14

(C) x=8, y=6

(D) = x=5, y=9

 

Tags : Polymorphism | Computer Science , 11th Computer Science : Chapter 15 : Polymorphism
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
11th Computer Science : Chapter 15 : Polymorphism : Choose the correct answer | Polymorphism | Computer Science


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.