2019 051401

B.Tech Examination, 2019

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Choose the correct option (any seven) :

a)

The compiler identifies a virtual function to be pure

a)

by the presence of the keyword pure

b)

by its location in the program

c)

if it is equated to 0

d)

None of the above

b)

For a method to be an interface between the outside world and a class, it must be declared

a)

private

b)

protected

c)

public

d)

external

c)

C++ encourages structuring a software as a collection of components that are

a)

highly cohesive and loosely coupled

b)

not highly cohesive but loosely coupled

c)

highly cohesive and tightly coupled

d)

not highly cohesive but tightly coupled

d)

The fields in a structure and class of a C program and C++ program respectively are by default

a)

public, protected

b)

protected, public

c)

private, private

d)

public, private

e)

Overloading is otherwise called as

a)

virtual polymorphism

b)

transient polymorphism

c)

pseudo-polymorphism

d)

ad-hoc polymorphism

f)

A constructor is called whenever

a)

an object is declared

b)

an object is used

c)

a class is declared

d)

a class is used

g)

class Dog : public X, public Y is an example of

a)

multiple inheritance

b)

repeated inheritance

c)

linear inheritance

d)

None of the above

h)

When a class serves as base class for many derived classes, the situation is called

a)

polymorphism

b)

hierarchical inheritance

c)

hybrid inheritance

d)

multipath inheritance

i)

The use of the break statement in a switch statement is

a)

optional

b)

compulsory

c)

not allowed. It gives an error message

d)

to check an error

Q2

Write a C++ program and class, with access specifiers, called 'student' having the following :

a)

Data members : name (char type), marks 1, marks 2, marks 3 (integer type)

b)

Functions : calc_total(); disp();

c)

The program asks the user to enter name and marks. Then calc_total() calculates the total marks and disp() displays name and total marks on screen in different lines.

Q3

Explain encapsulation with the help of an example. How it facilitates data abstraction?

Q4

Create a Message class with a constructor that takes a single string with a default value. Create a private member string, and in the constructor simply assign the argument string to your internal string. Create two overloaded member functions called print(): one that takes no arguments and simply prints the message stored in the object, and one that takes a string argument, which it prints in addition to the internal message. Does it make sense to use this approach instead of the one used for the constructor?

Q5

Write a small program to show the difference between calling a virtual function inside a normal member function and calling a virtual function inside a constructor. The program should show that the two calls produce different results.

Q6

With an example for generating Fibonacci series, explain how a function is invoked using pointers.

Q7

Assume that there is a class Derv that is derived from a base class Base. Write the declarator for a derived-class constructor that takes one argument and passes this argument along to the constructor in the base class.

Q9

Write short notes on the following :

a)

Overloading

b)

Overriding

c)

C++ STL

d)

Constructor


2018 051301

B.Tech Examination, 2018

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Choose the correct option of the following (any seven) :

a)

Which of the following types of class allows only one object of it to be created?

a)

Virtual Class

b)

Abstract Class

c)

Singleton Class

d)

Friend Class

b)

Which of the following statements is correct?

a)

Base class pointer cannot point to derived class.

b)

Derived class pointer cannot point to base class.

c)

Pointer to derived class cannot be created.

d)

Pointer to base class cannot be created.

c)

Which of the following statements is correct?

a)

A constructor is called at the time of declaration of an object.

b)

A constructor is called at the time of use of an object.

c)

A constructor is called at the time of declaration of a class.

d)

A constructor is called at the time of use of a class.

d)

Which of the following approaches is adapted by C++?

a)

Top-down

b)

Bottom-up

c)

Right-left

d)

Left-right

e)

Which of the following is not type of class?

a)

Abstract Class

b)

Final Class

c)

Start Class

d)

String Class

f)

What is default access specifier for data members or member functions declared within a class without any specifier in C++?

a)

Private

b)

Protected

c)

Public

d)

Depends on compiler

g)

Which is known as generic class?

a)

Abstract Class

b)

Final Class

c)

Template Class

d)

Efficient Code

h)

What is scope of a class nested inside another class?

a)

Protected scope

b)

Private scope

c)

Global scope

d)

Depends on access specifier and inheritance used

i)

Which syntax for class definition is wrong?

a)

Class student{};

b)

Student class{};

c)

Class student {public : student(int a){ }};

d)

Class student {student(int a){ }};

j)

Which among the following best describes the inheritance?

a)

Copying the code already written

b)

Using the code already written once

c)

Using already defined functions in programming language

d)

Using the data and functions into derived segment

Q2

What do you understand by object-oriented programming? What are the advantages of programming using object-oriented approach?

Q3

What are the different data types in C++? Explain that C++ is an object-oriented language.

Q4

What is a class? Also write an example (syntax) to define a class in C++. Differentiate between a class and an object.

Q5

What is inheritance? What are the different types of inheritance in C++? Explain with suitable diagram.

Q6

Write short notes with examples on each of the following with respect to C++ :

a)

Data abstraction

b)

Overriding

c)

Encapsulation

d)

Virtual function

e)

Constructor and destructor

Q7

What do you mean by polymorphism? What are the static and dynamic polymorphism techniques?

Q8

Define Exception Handling. What are the uses of keywords try, throw and catch? Explain with an example by writing a C++ program.

Q9

What is Access Modifier in C++? Define each type and also differentiate between these.


2017 051301

B.Tech Examination, 2017

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Choose the correct answer of the following (any seven):

a)

To prevent any method from overriding, we declare the method as

a)

static

b)

const

c)

final

d)

None of the above

b)

Which of the following types of class allows only one object of it to be created?

a)

Virtual class

b)

Abstract class

c)

Singleton class

d)

Friend class

c)

Multiple inheritance means

a)

one class inheriting from more superclasses

b)

more classes inheriting from one superclass

c)

more classes inheriting from more superclasses

d)

None of the above

d)

When the compiler cannot differentiate between two overloaded constructors, they are called

a)

overloaded

b)

destructed

c)

ambiguous

d)

overriding

e)

In C++, dynamic memory allocation is accomplished with the operator

a)

new

b)

this

c)

malloc

d)

delete

f)

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

g)

To perform file I/O operations, we must use _______ header file.

a)
b)
c)
d)

Any of these

h)

Which keyword is used to check exception in the block of code?

a)

Catch

b)

Throw

c)

Try

d)

None of the above

i)

What will happen when the exception is not caught in the program?

a)

Error

b)

Program will execute

c)

Block of that code will not execute

d)

None of the above

j)

Which of the following gives the memory address of integer variable a?

a)

*a;

b)

a;

c)

&a;

d)

address(a);

[14 Marks]
Q2

Distinguish between static binding and dynamic binding. Explain the use of virtual functions and the vtable in dynamic binding.

[14 Marks]
Q3

Answer the following:

a)

Explain adaptor class or wrapper classes with example.

[7 Marks]
b)

Explain dangling pointer with the help of an example.

[7 Marks]
Q4

Compare between overloading and overriding of functions with example.

[14 Marks]
Q5

Define a class CARTESIAN to represent a point in cartesian coordinates (x,y)(x, y) and class POLAR to represent it in polar coordinates (r,θ)(r, \theta). Use constructor conversion and operator conversion functions in class CARTESIAN to convert object of one type into another.

[14 Marks]
Q6

Answer the following:

a)

What is a friend function and what are its advantages?

[7 Marks]
b)

What are the guidelines that should be followed while using friend function?

[7 Marks]
Q7

Answer the following:

a)

Describe scope and life of a variable.

[7 Marks]
b)

Describe 'this' pointer with its applications.

[7 Marks]
Q8

With a suitable example, explain how a function is invoked using pointers.

[14 Marks]
Q9

Answer the following:

a)

What is a constructor? Describe the types of constructor each with an example.

[7 Marks]
b)

Explain pointer-to-pointer with an example.

[7 Marks]

2017 051401

B.Tech Examination, 2017

Time 3 hours
Full Marks 70
Instructions:
  • There are Nine Questions in this Paper.
  • Attempt Five questions in all.
  • Question No. 1 is Compulsory.
  • All questions carry equal marks.

Questions

Q1

Answer any Seven questions from this:

a)

The address of a variable temp of type float is

a)

*temp

b)

&temp

c)

Float & temp

d)

float temp&

b)

The process of building new classes from existing one is called ________.

a)

Polymorphism

b)

Structure

c)

Inheritance

d)

Cascading

c)

An array element is accessed using

a)

a FIFO approach

b)

an index number

c)

the operator

d)

a member name

d)

If there is a pointer p to object of a base class and it contains the address of an object of a derived class and both classes contain a virtual member function abc(), then the statement p->abc(); will cause the version of abc() in the ________ class to be executed.

a)

Base Class

b)

Derived class

c)

Produces compile time error

d)

Produces runtime error

e)

Overloading a postfix increment operator by means of a member function takes

a)

no arguments

b)

one argument

c)

two argument

d)

three argument

f)

What will be the output of the following program?

#include<iostream.h>
void main() {
    float x=5, y=2; int result;
    result=x%y; cout<<result;
}
a)

1

b)

1.0

c)

Error message

d)

2.5

g)

Member functions, when defined within the class specification:

a)

are always inline

b)

are not inline

c)

are inline by default, unless they are too big or too complicated.

d)

are not inline by default

h)

An exception is caused by

a)

a runtime error

b)

a syntax error

c)

a problem in the operating system

d)

a hardware problem

i)

Which of the following expressions is illegal?

a)

(10 6)

b)

(false && true)

c)

bool (x) = (bool) 10;

d)

float y = 12.67;

j)

What is the output of given code fragment?

int f=1, i=2; while(++i<5)
f*=i;
count<<f;
a)

12

b)

24

c)

6

d)

3

[14 Marks]
Q2

Answer the following:

a)

Explain the importance of using friend function in operator overloading with the help of an example.

[7 Marks]
b)

What is a default argument and constant argument? Explain each with an example.

[7 Marks]
Q3

Answer the following:

a)

Explain a pure virtual function with an example.

[7 Marks]
b)

What is function template? Give an example of it. Also differentiate between template class and class template.

[7 Marks]
Q4

Answer the following:

a)

How does inheritance influences the working of constructor and destructor? Give the following set of definitions

class x { };
class y: public x { };
class z: public y { };
z obj;
[7 Marks]
b)

Write a program to read three numbers x,yx, y and zz and evaluate RR given by R=z/(xy)R = z/(x-y). Use exception handling to throw an exception in case division by zero is attempted.

[7 Marks]
Q5

Answer the following:

a)

Explain the use of this pointer with an example. Explain what happens when a pointer is deleted twice.

[7 Marks]
b)

What is downcast? Explain why and when do we use protected instead or private.

[7 Marks]
Q6

Answer the following:

a)

What is a friend function? Explain the advantages of using friend classes.

[7 Marks]
b)

What is C-string? Give an example in support of your answer. Also explain the problem associated with C-string.

[7 Marks]
Q7

Answer the following:

a)

What is a container class? What are the types of container classes?

[7 Marks]
b)

Create an array that can hold ten integers, and get input form user. Display those values on the screen, and then prompt the user for an integer. Search though the array, and count the number of times the item is found.

[7 Marks]
Q8

Answer the following:

a)

What is a variable? Write rules for defining a variable in C++. Also explain different types of storage classes in C++.

[7 Marks]
b)

What is encapsulation? What are its advantages? How can encapsulation are enforced in C++?

[7 Marks]
Q9

Differentiate the following:

a)

Pointer to constant vs pointer constant

b)

Inspector vs Mutator

c)

Vectors vs Dequeues

d)

Realloc() vs free()

[14 Marks]

2016 051301

B.Tech 3rd Semester Examination, 2016

Time 3 hours
Full Marks 70
Instructions:
  • There are Nine Questions in this Paper.
  • Attempt Five questions in all.
  • Question No. 1 is Compulsory.
  • The marks are indicated in the right hand margin.

Questions

Q1

Explain briefly about the following terms (any seven):

a)

Overloading

b)

Overriding

c)

C++ STL

d)

Constructor

e)

Destructor

f)

Inheritance

g)

Encapsulation

h)

Templates

i)

Protected variable

j)

Private function

[14 Marks]
Q2

Write a C++ program to overload '-' operator to calculate age from date of birth and current date.

[14 Marks]
Q3

Answer the following:

a)

What is a friend function and what are its advantages?

[7 Marks]
b)

What are the guidelines that should be followed while using friend function?

[7 Marks]
[14 Marks]
Q4

Compare overloading and overriding of function with example.

[14 Marks]
Q5

What is exception handling? Write a C++ program to demonstrate the 'try', 'catch' and 'throw' keywords?

[14 Marks]
Q6

Define C++ classes to represent the information of an ORGANISATION having EMPLOYEES and CLIENTS. Provide subclasses MANAGER, CLERK and SUPPORT_STAFF. In this organisation employees work on projects requested by clients.

[14 Marks]
Q7

Answer the following:

a)

What is virtual function? Explain with an example.

[7 Marks]
b)

Explain the abstract class with an example.

[7 Marks]
[14 Marks]
Q8

Explain inline functions with an example program. What are the conditions, where inline functions cannot be expanded?

[14 Marks]
Q9

Answer the following:

a)

What is the difference between compile time and run time errors? What is the use of stack unwinding in exception handling?

[7 Marks]
b)

Discuss void, this and const pointers.

[7 Marks]
[14 Marks]

2016 051401

B.Tech 4th Semester Examination, 2016

Time 3 hours
Full Marks 70
Instructions:
  • All questions carry equal marks.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Choose the correct answer (any seven):

a)

What is the output of the following code?

char symbol[3]={'a','b','c'};
for (int index=0; index<3; index++)
    cout << symbol[index];

(i) a b c (ii) "abc" (iii) abc (iv) 'abc'

b)

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 (i) protected and public data only in C and B (ii) protected and public data only in C (iii) private data in A and B (iv) protected data in A and B

c)

In C++, the range of signed integer type variable is (i) 0 to 2162^{16} (ii) 215-2^{15} to 21512^{15} - 1 (iii) 27-2^7 to 2712^7 - 1 (iv) 0 to 282^8

d)

The function whose prototype is void getData(Item *thing); receives (i) a pointer to a structure (ii) a reference to a structure (iii) a copy of a structure (iv) four bytes

e)

Format flags may be combined using the (i) bitwise OR operator (|) (ii) logical OR operator (||) (iii) bitwise AND operator (&) (iv) logical AND operator (&&)

f)

Which of the following types of class allows only one object of it to be created? (i) Virtual class (ii) Abstract class (iii) Singleton class (iv) Friend class

g)

cout is a/an (i) operator (ii) function (iii) object (iv) macro

h)

The size of object is equal to (i) total size of member data variables (ii) total size of member function (iii) Both (i) and (ii) (iv) None of the above

i)

If A and B are Boolean variables, then the expression (!A) || (!B) is equivalent to which of the following conditions? (i) !(A && B) (ii) !(A || B) (iii) !(A) && !(B) (iv) True

j)

What will be stored in n by the following statements?

int n;
n = 17 + 10 / 7;

(i) 18 (ii) 3 (iii) 3.857.. (iv) 18.428..

[14 Marks]
Q2

Answer the following:

a)

Write a program that defines a shape class with a constructor that gives value to width and height. Then define two sub-classes triangle and rectangle, that calculate the area of the shape area(). In the main, define two variables a triangle and a rectangle and then call the area() function in this two variables.

[10 Marks]
b)

What are pure virtual functions? Write the syntax.

[4 Marks]
[14 Marks]
Q3

Answer the following:

a)

What is inline function? What are its advantages and disadvantages?

[7 Marks]
b)

Draw the exception handling model.

[7 Marks]
[14 Marks]
Q4

Answer the following:

a)

What is multilevel inheritance? How is it different from multiple inheritance?

[7 Marks]
b)

How can a common friend function to two different classes be declared?

[7 Marks]
[14 Marks]
Q5

Answer the following:

a)

What are the basic differences between manipulators and IOS member functions in implementation? Give examples.

[7 Marks]
b)

What is object-oriented programming? How is it different from procedure-oriented programming?

[7 Marks]
[14 Marks]
Q6

Answer the following:

a)

Explain the following functions with examples for manipulating file pointers: seekg(), seekp(), tellg(), tellp()

[7 Marks]
b)

What is the difference between passing a parameter by reference and constant reference? Explain with an example.

[7 Marks]
[14 Marks]
Q7

Answer the following:

a)

Write a program that asks the user for an integer number and find the sum of all natural numbers up to that number.

[7 Marks]
b)

Class Y has been derived from class X. The class Y does not contain any data members of its own. Does the class Y require constructor? State your answer with Yes or No and why.

[7 Marks]
[14 Marks]
Q8

Answer the following:

a)

What is operator overloading? List out the operators that cannot be overloaded.

[7 Marks]
b)

What are generic classes? Why are they useful? Explain with an example how these are implemented in C++.

[7 Marks]
[14 Marks]
Q9

Differentiate between the following and give examples to bring out the difference:

a)

Private and public inheritances

b)

Instantiation and specialization of a template class

c)

Static and dynamic bindings

d)

A class and a struct

[14 Marks]

2015 051401

B.Tech 4th Semester Examination, 2015

Time 3 hours
Full Marks 70
Instructions:
  • All questions carry equal marks.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Choose the correct option (any seven):

a)

Find out the error in following block of code:

if (x = 100)
    cout << "x is 100";

(i) 100 should be enclosed in quotations (ii) There is no semicolon at end of first line (iii) Equals to operator mistake (iv) Variable x should not be inside quotation

b)

Which of the following is not a jump statement in C++? (i) Break (ii) Goto (iii) Exit (iv) Switch

c)

Consider the following statements:

int *p;
int i, k;
i = 142;
k = i;
p = &i;

Which of the following statements changes the value of i to 143? (i) k = 143; (ii) *k = 143; (iii) p = 143; (iv) *p = 143;

d)

Which of the following is false? (i) Variable has scope and visibility (ii) Variables having scope may not be visible (iii) Variables having visibility may not have scope (iv) None of the above

e)

A class cannot be: (i) virtual (ii) generic (iii) inline (iv) friend

f)

Which of the following is/are false? (i) Inheritance is deriving new class from existing class (ii) In an inheritance, all data and function members of base class are derived by derived class (iii) We can specify which data and function members of base class will be inherited by derived class (iv) We can add new functions to derived class without recompiling the base class

g)

What is true about inline functions? (i) It's a compulsion on the compiler to make function inline (ii) It's a request to the compiler to make the function inline (iii) It's the indication to the compiler that the function is recursive (iv) It's the indication to the compiler that the function is member function

h)

The statement char s = 'A' will internally assign value to s is: (i) 0 (ii) 90 (iii) 65 (iv) 127

i)

If p is a pointer, then p++ means: (i) increment the value of p (ii) increment the pointer p (iii) increment the address of the variable to which p is pointing (iv) increment the value of the variable to which p is pointing

j)

Which of the following is not the member of class? (i) Static function (ii) Friend function (iii) Constant function (iv) Virtual function

[14 Marks]
Q2

Answer the following:

a)

Explain template and its type with an example.

[7 Marks]
b)

Write a program using function template to find the cube of a given integer, float and double number.

[7 Marks]
[14 Marks]
Q3

Answer the following:

a)

What is the output of the following code?

#include <iostream.h>
class A {
public:
    void f() {
        std::cout << "A::f" << std::endl;
    }
    virtual void g() {
        std::cout << "A::g" << std::endl;
    }
};

class B : public A {
public:
    void f() {
        std::cout << "B::f" << std::endl;
    }
    virtual void g() {
        std::cout << "B::g" << std::endl;
    }
};

int main(int argc, char** argv) {
    A a; B b;
    A* aPtr = &a;
    A* bPtr = &b;
    aPtr->f();
    aPtr->g();
    bPtr->f();
    bPtr->g();
    return 0;
}

Is there anything to be noticed? Explain it.

[10 Marks]
b)

What is virtual destructor? How virtual functions call up is maintained?

[4 Marks]
[14 Marks]
Q4

Explain the following:

a)

Conversion from class to basic type

[5 Marks]
b)

Function prototyping

[4 Marks]
c)

Overload resolution

[5 Marks]
[14 Marks]
Q5

Answer the following:

a)

Write the expressions to represent the following: (i) p is a function whose argument is a pointer to an array of characters and which returns a pointer to an integer. (ii) p is a function whose argument is a pointer to character and which returns a pointer to an array of ten integers.

[7 Marks]
b)

What is encapsulation? What are its advantages? How can encapsulation are enforced in C++?

[7 Marks]
[14 Marks]
Q6

Give the difference between—

a)

a pointer and a reference;

[5 Marks]
b)

new and malloc;

[4 Marks]
c)

object and class.

[5 Marks]
[14 Marks]
Q7

Answer the following:

a)

In which situation catch blocks are used? Also give types of catch handler in C++.

[7 Marks]
b)

Write a program to show the concept of rethrowing an exception.

[7 Marks]
[14 Marks]
Q8

Answer the following:

a)

Explain nested switch () case statement with an example and also show its output.

[7 Marks]
b)

What are iteration statements? Write a program in C++ for iteration statements (any one) and also show its output.

[7 Marks]
[14 Marks]
Q9

Answer the following:

a)

What is function overloading? How it differs from operator overloading?

[7 Marks]
b)

What are the differences between a C++ struct and C++ class?

[7 Marks]
[14 Marks]

2013 051301

B.Tech Examination, 2013

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Answer any seven questions :

a)

What do you understand by object-oriented programming? How is it different from procedural programming?

b)

What are keywords and identifiers? Explain with examples.

c)

Distinguish between (i) object and classes, and (ii) inheritance and polymorphism.

d)

Why do we need the preprocessor directive #include<iostream>?

e)

What are objects? How are they created?

f)

What is type conversion? Give example.

g)

Can we have more than one constructor in a class? If yes, explain the need for such a situation.

h)

What are enumeration types? Explain with examples.

i)

What are advantages of function prototypes in C++?

j)

When will you make a function inline? Why?

[14 Marks]
Q2

Answer the following:

a)

What is function overloading? Illustrate function overloading through addition function which adds two integer numbers and two float numbers.

[7 Marks]
b)

Explain break statement and continue statement with example.

[7 Marks]
Q3

Answer the following:

a)

What is a constructor? Explain different types of constructor.

[7 Marks]
b)

What are benefits of using functions? Write a C++ function to swap the contents of two variables aa and bb, using different parameter passing mechanisms.

[7 Marks]
Q4

Answer the following:

a)

What is virtual function? Explain with suitable example.

[7 Marks]
b)

With illustration, explain function overloading.

[7 Marks]
Q5

Answer the following:

a)

What are different types of polymorphism achieved in OOP? What are pure virtual functions?

[7 Marks]
b)

What is operator overloading? Give an example of operator overloading, using friend class.

[7 Marks]
Q6

Answer the following:

a)

Explain how base class member functions can be involved in a derived class if the derived class also has a member function with the same name.

[7 Marks]
b)

What is a Destructor? Write a class, using C++ without destructor and explain.

[7 Marks]
Q7

Answer the following:

a)

What are implicit pointer and static class member? Explain with examples.

[7 Marks]
b)

What is inheritance? Bring out the concept of various types of inheritance and importance of derived class with examples.

[7 Marks]
Q8

Answer the following:

a)

What is Exceptional Handling? How are exceptions handled in C++?

[7 Marks]
b)

What are Class Templates? Explain with examples.

[7 Marks]
Q9

Answer the following:

a)

What do you understand by void pointers? Write a program to show the use of void pointers.

[7 Marks]
b)

Explain the uses of try, throw and catch keywords, used for exceptional handling.

[7 Marks]

2013 051401

B.Tech Examination, 2013

Time 03 Hours
Full Marks 70
Instructions:
  • All questions carry equal marks.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer (any seven) :

Q1.1

Which of the following statements is correct?

a)

A reference is stored on heap

b)

A reference is stored on stack

c)

A reference is stored in a queue

d)

A reference is stored in a binary tree

Q1.2

How many parameters does a Default Constructor accept?

a)

0

b)

1

c)

2

d)

3

Q1.3

Destructor has the same name as the constructor and it is preceded by

a)

~

b)

!

c)

&

d)

?

Q1.4

Which of the following types of class allows only one object of it to be created?

a)

Virtual class

b)

Abstract class

c)

Singleton class

d)

Friend class

Q1.5

Which of the following statements is correct?

a)

Two functions having same number of argument, order and type of argument can be overloaded if both functions do not have any default argument

b)

Overloaded function must have default arguments

c)

Overloaded function must have default arguments starting from the left of argument list

d)

A function can be overloaded more than once

Q1.6

Which of the following statements is incorrect?

a)

Default arguments can be provided for pointers to functions

b)

A function can have all its arguments as default

c)

Default argument cannot be provided for pointers to functions

d)

A default argument cannot be redefined in later declaration

Q1.7

Which of the following is not a type of constructor?

a)

Copy constructor

b)

Friend constructor

c)

Default constructor

d)

Parameterized constructor

Q1.8

Which of the following access specifies is used in a class definition by default?

a)

Protected

b)

Public

c)

Private

d)

Friend

Q1.9

Which of the following statements is correct with respect to the use of friend keyword inside a class?

a)

A private data member can be declared as a friend

b)

A class may be declared as a friend

c)

An object may be declared as a friend

d)

We can use friend keyword as a class name

Q1.10

How many types of polymorphisms are supported by C++?

a)

1

b)

2

c)

3

d)

4

Q.2 Solve both questions :

Q2.1

Define string. How does a string type differ from C type string?

Q2.2

WAP in C++ that reads a particular string and displays the frequency of each character in the string.

Q.3 Solve both questions :

Q3.1

What is ST? Describe with example.

Q3.2

WAP in C++ using the function count() to how many elements in a container have a specified value.

Q.4 Solve both questions :

Q4.1

Explain exception handling and their types.

Q4.2

WAP in C++ to demonstrate the use of multiple Catch statements.

Q.5 Solve both questions :

Q5.1

Describe streams.

Q5.2

Write about the following functions: put(); get(); width(); getline(); fill().

Q.6 Solve both questions :

Q6.1

Describe polymorphism with suitable examples.

Q6.2

WAP in C++ using array of pointers to accept desired number of integers and display their sum.

Q.7 Solve this question :

Q7.1

What is inheritance? Describe its types with examples.

Q.8 Solve both questions :

Q8.1

Explain 'this' pointer. Differentiate between overloaded functions and function templates.

Q8.2

What is a virtual function? WAP to demonstrate use of virtual functions.

Q.9 Solve both questions :

Q9.1

Explain friend function along with example.

Q9.2

Describe type conversion with examples.


2013 V4 051401

B.Tech Examination, 2013

Time 03 Hours
Full Marks 70
Instructions:
  • All questions carry equal marks.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer (any seven) :

Q1.1

Which of the following statements is correct?

a)

A reference is stored on heap

b)

A reference is stored on stack

c)

A reference is stored in a queue

d)

A reference is stored in a binary tree

Q1.2

How many parameters does a Default Constructor accept?

a)

0

b)

1

c)

2

d)

3

Q1.3

Destructor has the same name as the constructor and it is preceded by

a)

~

b)

!

c)

&

d)

?

Q1.4

Which of the following types of class allows only one object of it to be created?

a)

Virtual class

b)

Abstract class

c)

Singleton class

d)

Friend class

Q1.5

Which of the following statements is correct?

a)

Two functions having same number of argument, order and type of argument can be overloaded if both functions do not have any default argument

b)

Overloaded function must have default arguments

c)

Overloaded function must have default arguments starting from the left of argument list

d)

A function can be overloaded more than once

Q1.6

Which of the following statements is incorrect?

a)

Default arguments can be provided for pointers to functions

b)

A function can have all its arguments as default

c)

Default argument cannot be provided for pointers to functions

d)

A default argument cannot be redefined in later declaration

Q1.7

Which of the following is not a type of constructor?

a)

Copy constructor

b)

Friend constructor

c)

Default constructor

d)

Parameterized constructor

Q1.8

Which of the following access specifies is used in a class definition by default?

a)

Protected

b)

Public

c)

Private

d)

Friend

Q1.9

Which of the following statements is correct with respect to the use of friend keyword inside a class?

a)

A private data member can be declared as a friend

b)

A class may be declared as a friend

c)

An object may be declared as a friend

d)

We can use friend keyword as a class name

Q1.10

How many types of polymorphisms are supported by C++?

a)

1

b)

2

c)

3

d)

4

Q.2 Solve both questions :

Q2.1

Define string. How does a string type differ from C type string?

Q2.2

WAP in C++ that reads a particular string and displays the frequency of each character in the string.

Q.3 Solve both questions :

Q3.1

What is ST? Describe with example.

Q3.2

WAP in C++ using the function count() to how many elements in a container have a specified value.

Q.4 Solve both questions :

Q4.1

Explain exception handling and their types.

Q4.2

WAP in C++ to demonstrate the use of multiple Catch statements.

Q.5 Solve both questions :

Q5.1

Describe streams.

Q5.2

Write about the following functions: put(); get(); width(); getline(); fill().

Q.6 Solve both questions :

Q6.1

Describe polymorphism with suitable examples.

Q6.2

WAP in C++ using array of pointers to accept desired number of integers and display their sum.

Q.7 Solve this question :

Q7.1

What is inheritance? Describe its types with examples.

Q.8 Solve both questions :

Q8.1

Explain 'this' pointer. Differentiate between overloaded functions and function templates.

Q8.2

What is a virtual function? WAP to demonstrate use of virtual functions.

Q.9 Solve both questions :

Q9.1

Explain friend function along with example.

Q9.2

Describe type conversion with examples.


2013 213658

B.Tech Examination, 2013

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Choose the correct answer (any seven) :

a)

Which of the following statements is correct? (i) A reference is stored on heap (ii) A reference is stored on stack (iii) A reference is stored in a queue (iv) A reference is stored in a binary tree

b)

How many parameters does a Default Constructor accept? (i) 0 (ii) 1 (iii) 2 (iv) 3

c)

Destructor has the same name as the constructor and it is preceded by (i) ~ (ii) ! (iii) & (iv) ?

d)

Which of the following types of class allows only one object of it to be created? (i) Virtual class (ii) Abstract class (iii) Singleton class (iv) Friend class

e)

Which of the following statements is correct? (i) Two functions having same number of argument, order and type of argument can be overloaded if both functions do not have any default argument (ii) Overloaded function must have default arguments (iii) Overloaded function must have default arguments starting from the left of argument list (iv) A function can be overloaded more than once

f)

Which of the following statements is incorrect? (i) Default arguments can be provided for pointers to functions (ii) A function can have all its arguments as default (iii) Default argument cannot be provided for pointers to functions (iv) A default argument cannot be redefined in later declaration

g)

Which of the following is not a type of constructor? (i) Copy constructor (ii) Friend constructor (iii) Default constructor (iv) Parameterized constructor

h)

Which of the following access specifies is used in a class definition by default? (i) Protected (ii) Public (iii) Private (iv) Friend

i)

Which of the following statements is correct with respect to the use of friend keyword inside a class? (i) A private data member can be declared as a friend (ii) A class may be declared as a friend (iii) An object may be declared as a friend (iv) We can use friend keyword as a class name

j)

How many types of polymorphisms are supported by C++? (i) 1 (ii) 2 (iii) 3 (iv) 4

[14 Marks]
Q2

Answer the following:

a)

Define string. How does a string type differ from C type string?

[7 Marks]
b)

WAP in C++ that reads a particular string and displays the frequency of each character in the string.

[7 Marks]
Q3

Answer the following:

a)

What is STL? Describe with example.

[7 Marks]
b)

WAP in C++ using the function count() to how many elements in a container have a specified value.

[7 Marks]
Q4

Answer the following:

a)

Explain exception handling and their types.

[7 Marks]
b)

WAP in C++ to demonstrate the use of multiple Catch statements.

[7 Marks]
Q5

Answer the following:

a)

Describe streams.

[7 Marks]
b)

Write about the following functions : put() ; get() ; width() ; getline() ; fill().

[7 Marks]
Q6

Answer the following:

a)

Describe polymorphism with suitable examples.

[7 Marks]
b)

WAP in C++ using array of pointers to accept desired number of integers and display their sum.

[7 Marks]
Q7

What is inheritance? Describe its types with examples.

[14 Marks]
Q8

Answer the following:

a)

Explain ‘this’ pointer. Differentiate between overloaded functions and function templates.

[7 Marks]
b)

What is a virtual function? WAP to demonstrate use of virtual functions.

[7 Marks]
Q9

Answer the following:

a)

Explain friend function along with example.

[7 Marks]
b)

Describe type conversion with examples.

[7 Marks]

2012 051301

B.Tech Examination, 2012

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Answer any seven MCQs :

a)

Which of the following is not a valid identifier in C++? (i) Return (ii) MyInt (iii) MyInteger (iv) Total3

b)

What is the value of xx after the following statements? int x; x = 0; x = x + 30; (i) 0 (ii) 30 (iii) 33 (iv) Garbage

c)

What is the value of the following expression? (true && (4/3 || !(6))) (i) True (ii) False (iii) 0 (iv) Illegal syntax

d)

When defining a class, the class should be composed of the kind of values a variable of the class can contain, and (i) member functions for that class (ii) the keyword private (iii) other class definitions (iv) nothing else

e)

Data members or member functions of a class that are declared to be private may (i) only be accessed by the main program (ii) only be accessed by members of the class (iii) not be accessed by the class (iv) be considered as global variables

f)

When overloading an operator, which of the following is true? (i) One of the arguments must be an object of the class (ii) The operator can be a friend or a member of the class (iii) The operator does not have to be a friend or a member of the class (iv) All of the above (v) None of the above

g)

class derived : public base1, public base2 {} is an example of (i) polymorphic inheritance (ii) multilevel inheritance (iii) hierarchical inheritance (iv) multiple inheritance

h)

In the derived class definition, you list from the base class (i) all the member functions every time (ii) only those member functions that need to be redefined (iii) only those member functions that were in the public section (iv) only those member functions you want to overload

i)

Which of the following is not a valid reason for using exception handling? (i) Throw and catch can be used like goto (ii) The procedure for handling an error depends on the situation (iii) Need to handle built-in exceptions (iv) None of the above

j)

You should make a function a virtual function if (i) every class that is derived from this class uses all the member functions from this class (ii) every class that is derived from this class needs to redefine this function (iii) that function is an operator (iv) only in the derived classes

[14 Marks]
Q2

Answer the following:

a)

Write five differences between Procedural and Object-Oriented Programming.

b)

Differentiate between Private, Public and Protected data members of the class using examples.

Q3

Answer the following:

a)

Mention the difference between C and C++. Why is it necessary to include header files in a program written in these languages?

b)

Write a C++ program to find the sum of the series 1+3+5++n1+3+5+\dots+n.

c)

Define copy constructor. Explain its significance. Under which condition is it invoked? Support your answer with an example.

Q4

Answer the following:

a)

Discuss the basic data types of C++. Suggest appropriate data type for the following:

b)

Write a program, which will accept a string of maximum 10 characters from the keyboard, and count the occurrences of each of the 5 vowels in the string. The output should be in tabbed format as shown below:

A E I O U 0 1 0 0 1

c)

Explain branching statements used in C++ with example.

Q5

Answer the following:

a)

What is operator overloading in C++? Explain with suitable example. Also list operators which cannot be overloaded.

b)

Differentiate between Operator and Function overloading with the help of suitable example.

Q6

Answer the following:

a)

Create a class complex and implement the following:

b)

With relevant examples, explain (i) multilevel inheritance (ii) hybrid inheritance.

Q7

Answer the following:

a)

Explain the concept of a destructor in a class. What is its role in terms of cleanup of unwanted objects?

b)

How is an exception handling performed in C++? Write a program that throws an arithmetic exception as and when a number input is greater than 9999.

Q8

Answer the following:

a)

Design and implement a class string using an array, with a maximum size of 20 characters. The class should contain the necessary constructors, destructor, overloaded assignment operator and a friend function for concatenation of two strings. Make suitable assumptions if required. Also write main() for the above.

b)

What is an inline function? In which situations would you make a function inline? Give two examples of inline functions.

Q9

Answer the following:

a)

Syntactically explain nested "if-else" statement in C++.

b)

Define the following:


Install on iOS

To install BEU Connect on your iPhone:

1. Tap the Share button at the bottom of Safari.
2. Scroll down and tap "Add to Home Screen".