Vous êtes sur la page 1sur 9

Dr. N.G.P.

INSTITUTE OF TECHNOLOGY
Coimbatore-641048

DEPARTMENT OF INFORMATION TECHNOLOGY

Multiple Choice Questions

CS6301/PROGRAMMING AND DATA STRUCTURES II


REGULATION: 2013 (AU – CHENNAI)

Prepared by Reviewed by
Mrs.K.Mouthami,AP/IT Academic Coordinator

Approved by

HoD/IT Principal
CS6301 PROGRAMMING AND DATA STRUCTURES II

UNIT I OBJECT ORIENTED PROGRAMMING FUNDAMENTALS


1. Constant variables can be created in CPP by using ________ .
a. enum
b. const
c. #define
d. All of these
e. None of these

2. In CPP, cin and cout are the predefined stream __________ .


a. Operator
b. Functions
c. Objects
d. Data types

3. Which one is suitable syntax for function template?


a. template< class T> return_type Function_Name(parameters)
b. template< typename T> return_type Function_Name(parameters)
c. both a and b
d. None of these

4. Object based language differs from object oriented language as it does not support features
1.Encapsulation
2. Inheritance
3. Dynamic Binding
4. Abstraction
5. Polymorphism
a. only 3 ,4
b. only 1,3,5
c. 2,4,5
d. Only 2,3

5. Which of the followings is/are not keyword/s in CPP?


1. asm
2. boolean
3. mutable
4. export
5. constant_cast
a. Only 5
b. Only 1 and 4
c. Only 1,2 and 5
d. Only 2 and 5

6. ____________ refers to the act of representing only essential features without including the
background details.
a. Data Hiding
b. Data Encapsulation
c. Data Abstraction
d. All of these
7. Which of the followings are false statements about Local class?

1. A local class type name can only be used in the enclosing function
2. All the methods of Local classes must be defined inside the class only
3. A Local class can contain static data members.
4. A Local class may contain static functions.
5. Non-static variables of the enclosing function are not accessible inside local classes.
6. Local classes cannot access global types, variables and functions.
a. Only 1,3
b. Only 3, 6
c. Only 2 , 4 , 6
d. None of these

8. Only functions of the class can access the data of the class and they(functions) provides the
interface between data, objects and the program. This kind isolation of the data from direct
access by the program is called _______________ .
a. Data Abstraction
b. Data Hiding
c. Data Binding
d. Data Encapsulation

9. Predict the output:

int x = 786;
cout << setfill(‘*’) << setw(6) << x;

- Published on 17 Jul 15
a. 786***
b. **786
c. ***786
d. ******

10. Static variable declared in a class are also called_________ .


a. instance variable
b. named constant
c. global variable
d. class variable

UNIT II OBJECT ORIENTED PROGRAMMING CONCEPTS


1. A virtual function that has no definition within the base class is called____________.
a. Pure virtual function
b. Pure static function
c. Pure Const function
d. Friend function

2. If abstract class is inherited by derived class, then_______________ .


a. Derived class should provide definition for all the pure virtual functions
b. Derived class also become abstract if fails to implement pure virtual functions
c. Objects of derived class can’t be created if it fails to implement pure virtual functions
d. All of these
3. If a class contains pure virtual function, then it is termed as____________________ .
a. Virtual class
b. Sealed class
c. Pure Local class
d. Abstract Class

4. Syntax for Pure Virtual Function is ______________ .


a. virtual void show()==0
b. void virtual show()==0
c. virtual void show()=0
d. void virtual show()=0

5. _______________ is a member function that is declared within a base class and redefined by
derived class.
a. virtual function
b. static function
c. friend function
d. const member function

6. While overloading binary operators using member function, it requires ___ argument/s.
a. Zero
b. One
c. Two
d. Three

7. Scope resolution operator is used______ .


a. to resolve the scope of global variables only
b. to resolve the scope of functions of the classes only
c. to resolve scope of global variables as well as functions of the classes
d. None of these

8. Which of the following is not a casting operator in CPP?


a. explicit_cast
b. static_cast
c. dynamic_cast
d. reinterpret_cast

9. An operator function is created using _____________ keyword.


a. iterator
b. allocator
c. constructor
d. operator

10. Using friend operator function, following perfect set of operators may not be overloaded.
a. = , ( ) , [ ] , ->
b. <<, = = , [ ] , >>
c. ?, = , ( ) , ++
d. None of these

UNIT III C++ PROGRAMMING ADVANCED FEATURES


1. While overloading binary operators using member function, it requires ___ argument/s.
a. Zero
b. One
c. Two
d. Three

2. In case of operator overloading, operator function must be ______ .

1. Static member functions


2. Non- static member functions
3. Friend Functions
a. Only 2
b. Only 1, 3
c. Only 2 , 3
d. All 1 , 2, 3

3. Which of the following is not a casting operator in CPP?


a. explicit_cast
b. static_cast
c. dynamic_cast
d. reinterpret_cast

4. Which of the following manipulator is used for the representing octal equivalent of a given
decimal number?
a. oct
b. setbase(8)
c. tobase(8)
d. both a and b
e. all a, b, c

5. In case of binary operator overloading with member function, which of following statement
should be taken into consideration?
a. Right hand operand must be object.
b. Left hand operand must be object.
c. Both the operands must be objects.
d. All of these should be considered.

6. By default, all the files are opened in ___________mode .


a. Binary
b. Text
c. Can’t say

7. Which of the following is not a file opening mode ____ .


a. ios::ate
b. ios::nocreate
c. ios::noreplace
d. ios::truncate

8. __________ is return type of is_open() function.


a. int
b. bool
c. float
d. char *

9. To create an output stream, we must declare the stream to be of class ___________ .


a. ofstream
b. ifstream
c. iostream
d. None of these

10. Streams that will be performing both input and output operations must be declared as class
_________ .
a. iostream
b. fstream
c. stdstream
d. Stdiostream

UNIT IV ADVANCED NON-LINEAR DATA STRUCTURES

1. Consider a two dimensional array of integers arr[1…. 10][1…. 15]. One memory location is
occupied by each integer. The first element of array is stored at location 100 and the array is
stored in row-major order. The address of the element arr[i][j] is

(A) 15j + i + 84
(B) 15i + j + 84
(C) 21i + j + 93
(D) 21j + I + 93

2. Assuming that the height of a tree with a single node is 0, the maximum height of any AVL-
tree with 7 nodes is

(A) 5
(B) 4
(C) 3
(D) 2

3. The order of precedence from highest to lowest is ∧, x, +, - assuming that the operators +, -, x
are left associative and ∧ is right associative. The infix expression is a + b x c – d ∧ e ∧ f. The
postfix expression corresponding to infix expression is

(A) -+axbc∧ ∧def


(B) ab+cxd-e∧f∧
(C) abc x +de∧f∧
(D) abcx+def∧ ∧-

4. Consider four modules whose lengths are 200, 800, 600 and 500. These modules are read by a
linker and are loaded in that order. The relocation constants are

(A) 0, 200, 1000, 1600


(B) 0, 200, 500, 600
(C) 200, 500, 600, 800
(D) 200, 700, 1300, 2100
5. The programming language feature that cannot be implemented on a certain processor, which
supports only immediate and the direct addressing modes is

(A) Pointers
(B) Records
(C) Arrays
(D) Recursive procedures with local variables
6. A postfix expression with single digit operands that is evaluated using stack is
8 2 3 ∧ / 2 3 * + 5 1 * - (where ∧ is the exponentiation operator).

6. What are the top two elements of the stack after the first * is evaluated?

(A) 1, 8
(B) 5, 7
(C) 2, 3
(D) 6, 1
7. Match the following:

P : m = malloc (5); m = NULL; 1: Using dangling pointers


Q : free (x); x-> value = 5; 2: Using uninitialized pointers
R : char *m; *m = ‘s’; 3: Lost memory

(A) P – 2, Q – 1, R - 3
(B) P – 3, Q – 2, R - 1
(C) P – 3, Q – 1, R - 2
(D) P – 1, Q – 3, R – 2

8. What is the output of the following program?


char p[20]
char *x = “string”;
Int length = strlen(x);
for (i = 0;i<length;i++)
p[i] = x[length –1];
printf (“%s”, p);

(A) string
(B) gnirt
(C) gnirts
(D) Output is not printed

9. What is the advantage of chained hash table (external hashing) over open addressing scheme?

(A) Easier deletion is possible


(B) Less space is required
(C) Worst case complexity of search operations is less
(D) None of the above

10. Consider an unlabelled binary tree with n number of nodes and a set of n distinct elements.
With the given set, in how many ways the tree can be populated so that it becomes a binary
search tree?
(A) (1 / n +1) 2n Cn
(B) n!
(C) 0
(D) 1

UNIT V GRAPHS

1.Which data structure is used in breadth first search of a graph to hold nodes?
A) Stack
B) queue
C) Tree
D) Array

2. The operation of processing each element in the list is known as ......


A. sorting
B. merging
C. inserting
D. traversal

3.In a graph if e=[u,v], Then u and v are called ........


A. End points of e
B. Adjacent nodes
C. Neighbours
D. All of the above

4.In a extended-binary tree nodes with 2 children are called ........


A. Interior node
B. Domestic node
C. Internal node
D. Inner node

5.TREE[1]=NULL indicates tree is ........


A. Overflow
B. Underflow
C. Empty
D. Full

6.In a graph if E=(u,v) means ......


A. u is adjacent to v but v is not adjacent to u
B. e begins at u and ends at v
C. u is processor and v is successor
D. both b and c

7.Binary trees with threads are called as .......


A. Threaded trees
B. Pointer trees
C. Special trees
D. Special pointer trees
8.Graph G is .............. if for any pair u, v of nodes in G there is a path from u to v or path from v
to u.
A. Leterally connected
B. Widely Connected
C. Unliterally connected

D. Literally connected

9.Other name for directed graph is ..........


A. Direct graph
B. Digraph
C. Dir-graph
D. Digraph

10.A connected graph T without any cycles is called ........


A. free graph
B. no cycle graph
C. non cycle graph
D. circular graph

Vous aimerez peut-être aussi