2016 - 1st Internal Paper
2016 - 1st Internal Paper
2016 - 1st Internal Paper
Q-1[A] Select the most appropriate option from the given options. [05]
[1] Which of the following concepts mean wrapping up of data and functions
together?
(a) Abstraction (b) Encapsulation
(c) Inheritance (d) Polymorphism
[2] Which of the following approach is adapted by C++?
(a) Top-down (b) Bottom-up
(c) Right-left (d) Left-right
[3] Which one is the correct in C++?
(a) float function(char c=’a’, int d=3, float z=44.00);
(b) double function(int d=3, float z=9.12, char d);
(c) char * function(float z=1, double d, int x=10);
(d) int function(double x=1, int f, float d);
[4] Which one is the correct in C++?
(a) Static data member cannot be accessed by normal member function.
(b) While defining a static variable, some initial value cannot be assigned.
(c) Static member function can access all data members.
(d) Static member function can be called using the class name instead of object.
[5] Which of the following concept of OOP allows compiler to insert arguments in
a function call if it is not specified?
(a) Default argument (b) Call by value
(c) Call by reference (d) Call by pointer
[B] State following statements are TRUE/FALSE with reason. [03]
[1] Object is the instance of class.
[2] Static variables exist for the life of the program.
[3] Destructor can be overloaded.
[4] If the member function is defined outside the class then it is inline by default.
[5] All the members of structure are by default private.
[6] Constructor cannot be defined outside the class.
[C] Differentiate: Member function vs. Normal function [02]
Page 1 of 2
Q-2 Answer the following. (ANY FIVE) [10]
[1] Explain inline function with example.
[2] Differentiate: Procedural vs object oriented programming.
[3] Draw the Memory layout of the class having two member functions and two data
members of 3 objects.
[4] Explain the purpose of new and delete operators with example in C++.
[5] What care should be taken while giving defaults arguments to a function?
[6] What will be the output of following code:
#include<iostream.h>
void count();
int main()
{
for(int i=0;i<3;i++)
{ count();
}return 0;
}
void count( )
{ static int a=0;
a=a+1;
cout<<a<<endl;
}
[7] What will be the output of following code:
class A
{
char a;
float b;
static int d;
double e;
};
int main()
{
A ob;
cout<<sizeof(ob);
return 0;
}
Q-3 Answer the following. (ANY TWO) [10]
[1] Create two classes having names INTEGER and FLOATING. INTEGER class has
data member A of int type and two member functions to read and display the data.
FLOATING class has data member B of float type and two member functions to
read and display the data. Define function add( ) which takes objects of both the
classes as arguments with reference and add both objects and return its equivalent
answer in float. Write main( ) to test both the classes.
[2] Create a class having name FULLDATE with data members date, month and year.
Create default constructor, parameterized constructor, copy constructor and
destruction for the class. Also create member functions to display the data. Write a
C++ program to create three objects of class to demonstrate the use of specified
types of constructors and display the values of them.
[3] Write a C++ program having three functions with same name ADD but having
different arguments. First will do addition of two float values, second will do
addition of two int values and third will do addition of one int and one float value.
[4] Create a class MEASURE having data members float mtr. Define member
functions to input and display data. Also define member functions that supports the
statements M1=2.0+M2;. Write main( ) to test the class.
*********
Page 2 of 2