How To Exam?

a knowledge trading engine...


Biju Patnaik University of Technology 2007 B.Tech Computer Science and Engineering oops - Question Paper

Friday, 24 May 2013 01:20Web

THIRD SEMSTER 07
OBJECT ORIENTED PROGRAMMING

ques. 1(compolosory) (2*10)
(a)
what is a C++ template?
(b)
What is the best way to declare and describe global variables?
(c)
What is inheritance and elaborate the various kinds of inheritance available in C++?
(d)
What is constuctor and What is default constructor?
(e)
What is the diffence ranging from chat a[]="string";
and char *p="string";?
(f)
How do you decide to which integer kind to use?
(g)
How do you declare a array of N pointers to functions returning pointers to functions returning pointers
to Characters?
(h)
What is "abstraction" and why do we use it?
(i)
What is invariant?
(j)
What is the difference among public,protected and private members of a class?

ques. 2
(a)
How does an inline function differs from preprocessor macro?(2)
(b)
How is polymorphism is achieved at compile time and run time?
provide an example of a program that uses polymorphism.(3)
(c)
describe a class for a complex number .Write a program to learn and print the complex numbers.(5)

ques. 3
(a)
The voltage gain of an amplifier is provided by the formula




where f is the frequecy in Hertz and n is the number of stages in the amplifier.
Write a complete C++ program that asks the user to input the values for n and f.
calculates the value of the voltage gain using the formula and produces the subsequent display
on the terminal screen:
At a frequency of X Hertz , the voltage gain is Y.
Where X is changed by the frequency and Y changed by the voltage gain.(5)
(b)
Write a function that returns the mean of the n elements of an array of double kind.(5)

ques. 4
(a)
List the 3 ways of passing a parameter (or return value) in C++. For every indicate:
->Whether the meathod makes a copy of the object passed.
->Whether the method allows passing of constant objects.
->Whether the method supports polymorphism and virtual dispatch.
->Whether the meathod allows implict kind conversion to be performed(5)
(b)
Write a template function "max" that returns the largest element in an array of N elements.
YOU can presume that N>1.
choose a reasonable and simple interface.(5)

ques. 5
(a)
What does the reference operator do?
What is the difference ranging from passing and argument by reference and passing by Value?(4)
(b)
Consider the subsequent class Foo, (for which 1 constructor is written ).
Write a destructor, a copy constructor and an assignment operator that would ve improper for the
class.(6)

Class Foo{
public:
int *p;
Foo(void){
p=new int[10];
for(int k=0;k<10;k+=1){
p[k]=k;
}
}

ques. 6
(a)
Declare a C++ structure to contain the subsequent 5 pieces of info about cars on a used car lot:
1.the manufacture of the car
2.the model mane of the car,
3.the number of miles on the odometer,
4. the asking price for the car. (4)

(b)
Write a template function alloc that takes 2 parameters:
n: The size of the array to allocate
val: a value of kind T
The alloc function should allocate an array of kind T with n elements and set all elements in the array to
the value val.The pinter to the array is returned.(6)

ques. 7
(a)
provide 2 various ways that an alias can be created for an integer variable i in C++ program.(4)
(b)
Write a program that uses a 2-dimensional m*n double array A.Declare the variable A and write the C++
code needed to allocate and deallocate the array (assume that m and m are declared and their values known).(6)


ques. 8

(a)
Distinguish ranging from virtual member function and non-virtual member function .(2.5)
(b)
Why are internal data members of a base class declared protected instead of private?(2.5)
(c)
describe the terms static scoping and dynamic scoping and provide a very simple example of every.(2.5)
(d)
discuss what the subsequent 3 lines "do" when executed?(2.5)
Tmp=new int (10);
*Tmp=65;
delete[] Tmp;




( 0 Votes )

Add comment


Security code
Refresh

Earning:   Approval pending.
You are here: PAPER Biju Patnaik University of Technology 2007 B.Tech Computer Science and Engineering oops - Question Paper