1)In
(a)Beginning from a node,firsdt all its adjacent nodes are traversed.
(b)Beginning from a node, each adjacent node is fully explored before traversing the next adjacent node
(c)Beginning from a node, nodes are traversed in cyclical order
(d)None of these
2) What is the minimum number of division checks required to check whether a number is prime or not?
(a)
(d) sqrt(number) divisions
3) How can a call to an overloaded function be ambiguous?
(a) By misspelling the name (b) There might be two or more functions with the same name (c)There might be two or more functions with equally appropriate signatures
(d)None of these
4)Neha wants to write a program that converts a decimal number into a binary number. Which of the following data structures should she use to
implement the same?
(a)Queue (b)Stack (c)Array (d)Linked List
5)Consider the following
class rocket
{
private:
integer height, weight public: // Statement 1 function input( int a, int b)
{
height = a; weight = b;
}
}
function main ( )
{
rocket rocket1, rocket2
}
What can we infer from this code?
(a) rocket is a class with rocket1 and rocket2 as its objects. height and weight are attributes of a rocket.
(b)rocket is a class with rocket1 and rocket2 as its attributes. Height and weight are objects of the class rocket.
(c)rocket is a class with rocket1, rocket2, height and weight as its attributes.
(d)rocket is a class with rocket1, rocket2, height and weight as its objects
6) Which of the following options describes a tree
(a)An unconnected graph (b) A connected graph (c) A connected acyclic graph (d)A complete graph
7) How does inheritance relate to abstraction? |
|
(a)A base class is an abstraction of all its derived classes |
ANS:S(B) |
(b)A derived class is an abstraction of all its base classes |
|
(c)Base and derived classes are abstractions for each other |
|
(d)Inheritance prevents abstraction |
|
8) Which of the following options is responsible for taking files and objects from different locations and combining them for execution?
(a)Linker (b)Loader (c)Interconnecting compiler (d)Interpreter
9) A complete binary tree with the property that the value at each node is atleast as large as the values at its children is known as
(a)Binary Search Tree (b)AVL Tree (c)Completely Balanced Tree (d)Heap ANS:(D)
10) function main()
{
automatic variable var print var
}
What will be the output generated when the given code is executed?
(a)0 (b)1 (c) Garbage Value (d)This code will generate a compile time error ANS:(C)
11) Which of the following sorting methods is stable?
(a)Straight Insertion Sort (b)Binary Insertion Sort (c)Shell Sort (d)Heap Sort ANS:(A)
11) Consider the following
{
private:
integer size, colorcode
function getdata( ) { ... }// Statement 1 public:
integer name // Statement 2 function putdata( ) { ... }
}
function main
{
brush b1, b2
print b1.name // Statement 3 b2.getdata( ) //Statement 4
}
Deleting which line will correct the error in the code?
(a)Statement 1 (b)Statement 2 (c)Statement 3 (d)Statement 4
12) Passage:
Mary is making a database of animals in a zoo and their properties. The possible animals are dog, lion and zebra. Each one has as attributes isHerbivorous, colour and isNocturnal. She uses the object oriented programming paradigm for this. How will she conceptualize the system?
(a) class: Animal; objects: dog, lion and zebra; data members: is Herbivorous, colour and is Nocturnal
(b)class: Animal; objects: is Herbivorous, colour and is Nocturnal; data members: dog, lion and zebra
(c)classes: dog, lion and zebra; objects: Animal; data members: is Herbivorous, colour and is Nocturnal
d)None of these
13) integer i, k ,j, n =5 for i=n to 1 decrement 1
{
for j=n to i+1 decrement 1
{
print blank space
}
for k=1 to
{
print "*"
}
print
}
What will be the output when the given code is executed?
a)
*
*****
****
***
**
*
b)
*****
****
***
**
*
c)
*****
****
*****
****
*****
d)
*
**
***
****
*****
e)
*********
*******
*****
***
*
14) What is the term used to describe the situation, when a function in the base class is redefined in the inherited class?
(a)Inheritance (b)Overriding (c)Overloading (d)Encapsulation ANS:(B)
15) Revti has a Linear Linked List with the element values as given below - {4, 6, 5, 7, 8, 3, 5, 4}
She wants to print the list in this order - {4, 5, 3, 8, 7, 5, 6, 4}
Which of the following data structures will help her out?
(a)Queue (b)Stack (c)Array (d)Tree
16) Yukta created an interface to use it in different parts of the program by implementing it. But she forgot to specify the access specifier for each contained method. What will be the access specifier of the methods that will be inherited/implemented?
(a)Public (b)Private (c)Protected (d)An error will be generated
17) As part of the maintenance work, you are entrusted with the work of rearranging the library books in a shelf in proper order, at the end of each day. The ideal choice will be (a)Bubble Sort (b)Insertion Sort (c)Selection Sort (d)Heap Sort ANS:(B)
18) enum names {AMAR,AKBAR,ANTHONY} function main()
{
print AMAR print AKBAR print ANTHONY
}
What will be the output generated when the given code is executed?
(a)000 (b)012 (c)123 (d)111
19) In
(a)Beginning from a node, first all its adjacent nodes are traversed.
(b)Beginning from a node, each adjacent node is fully explored before traversing the next adjacent node.
(c)Beginning from a node, nodes are traversed in cyclical order (d)None of these
20) What is the minimum number of division checks required to check whether a number is prime or not?
(a)
(d) sqrt(number) divisions
21) Suppose that a graph is represented as adjacency matrix and a BFS(Breadth First search) algorithm is modified to handle such input graphs. Which of the following options refers to the running time of such an algorithm given that the number of vertices in the graph is V and number of edges is E?
(a) O(V*V) (b)O(V*V+E) (c)O(E*E+V) (d)O(E*E)
22) Parthiv has included several classes and their objects in his project. Now he wants to use something that will hold all these objects(of different classes). Which of the following options provides him with the best alternate?
(a)Store them in database (b)Final Class (c)Generic Class (d)Anonymous Class
23) Which of the given options refers to data encapsulation in object oriented programming?
(a) The data and operations for an object are defined and fixed. (b)The data of an object is encapsulated in its class.
(c)The data is hidden for an object (d)A class can have multiple objects
24) Which of the following options is true with regard to private and protected members of a class?
(a)Both have the same properties with regard to an object of the class.
(b)Private members cannot be directly accessed, while protected members can be directly accessed.
(c)Protected members cannot be accessed by member functions, while
private members can be accessed by member functions.
(d) Private and protected members are same in all regards.
25) There is a class which contains two integers as private members. There are two member functions (public) defined on it, one to add the two integers and another to subtract the two integers. Ravi wants to add a new functionality, which enables multiplication of the two numbers. Which one of the following options he should adopt?
(a)He should define a third member function (public) which multiplies the two numbers.
(b)He should define member functions (public) to return value of both the integers and then multiply them in his code. By returning the values, he can in future do any operation on them giving extensibility to the code.
(c)He should define a third member function (private) which multiplies the two numbers.
(d)He should define member functions (private) to return value of both the integers and then multiply them in his code. By returning the values, he can in future do any operation on them giving extensibility to the code.
26) Which of the following sorting techniques has the worst case functioning time less than O(n*n)?
(a)Heap Sort (b)Quick Sort (c)Insertion Sort (d)Selection Sort
27) Which of the following sorting methods is stable?
(a)Straight Insertion Sort (b)Binary Insertion Sort (c)Shell Sort (d)Heap Sort
28) function main()
{
integer a=5, b=7 switch(a)
{
case 5: print "I am 5" break
case b: print "I am not 5" break
default: print "I am different"
}
(a) I am 5 (b)I am not 5 (c)I am different (d)This code will generate an error
29) Trisha wants to use a data structure in which the cost of deleting, adding and traversing its elements is the same and constant. Which of the following data structures should she use ?
30) A tree has 5 levels and each node has either 4 children or no children. All nodes on the same level have the same number of children. How many nodes are there in the tree? (Root is Level 1)
(a)341 (b)256 (c)1024 (d)None of these
31) Ravi uses the given statement in his code. Result = (num1 + num2)/(num1 - num2)
He ran his code several times but got error occasionally. Which of the following options is used to refer to such an error?
(a)Logical Error (b)Syntax Error (c)Semantic Error (d)Latent error
32)Which of the following options is an exception to being a part of composite data types? (a)Union (b)Array (c)Structure (d)Stack
33)What is the term used to describe the situation, when a function in the base class is redefined in the inherited class?
(a)Inheritance (b)Overriding (c)Overloading (d)Encapsulation
34) Null function is also known as _________
(a)Anonymous Function (b)Generic Function (c)Void Function (d)Null Operator ANS:(D)
35) Passage:
Consider a binary tree implementation. The root address is stored in the variable root. Given the address of a node in variable node, its value, right and root child node address can be accessed using the following statements respectively:
function preordertraverse(node)
{
print node
{
{
}
What is condition X and Condition Y?
(a)Condition X: node
(b)Condition X: node
(c)Condition X: node
Condition Y: node |
ANS:(C) |
(d) Condition X: node
36) In a ______________ , there is no beginning and no end.
(a) Queue (b) Deque (c) Doubly Linked List (d) Circular Linked List
37) _____________ is the compile time binding whereas _____________ is run time binding of functions
(a)Function overriding, Function overloading (b)Abstraction, Encapsulation
(c)Function overloading, Function overriding ANS:(C) (d)Varies from program to program
38) A full binary tree with n
(a)(log n) nodes (b)n + 1 nodes (c)2n + 1 nodes (d)2n nodes ANS:(C)
39) Hema has a certain list of data elements. She wants to use a technique from the given list of sorting techniques with its worst case complexity less than O(n*n).
1)Quick Sort
2)Merge Sort
3)Heap Sort
Which of the above mentioned techniques can she use to bring out the same?
(a)Only 1 (b)Only 2 (c)Only 3 (d)Both 2 and 3 (e)Both 1 and 3
40) Passage:
Srujan writes a sorting algorithm. The algorithm takes different amount of time to sort two different lists of equal size. What is the possible difference between the two lists?
(a) All numbers in one list are more than 100, while in the other are less than 100.
(b)The ordering of numbers with respect to magnitude in the two list has different properties.
(c)One list has all negative numbers, while the other has all positive numbers.
(d)One list contains 0 as an element, while the other does not
41) Passage:
function Display( string MyStr ) //Statement 1
{
print "Hello My name is" print MyStr //Statement 2
}
function main() // Statement 3
{
string str = " Mr.Beans"
integer num = Display( str ) // Statement 4
}
Consider the given code to print a name on the screen. Which statement will generate an error?
(a)Statement 1 (b)Statement 2 (c)Statement 3 (d)Statement 4 (e)This code will run without any error
46) A destructor may be invoked in which of the following situations?
(a)When the object is created (b)When the object is assigned value 0. (c)Only at the end of the code (d)When the scope of the object is over ANS:(D)
47) What is the term given to the memory allocation that takes place during run time rendering the resizing of an Array?
(a)Static Allocation (b)Dynamic Allocation (c)Automatic Allocation (d)Executive Allocation
48) Ritika was asked to include concrete objects in her project. Which of the following statements clearly states about the concrete objects?
(a)All the objects created as the instance of a class
(b)Objects created using the new keyword
(c)Variables and objects that follow the concrete keyword
(d)Objects created under conditional statements
49) What are the maximum number of edges in a
(a) |
ANS:(A) |
50) Akshit has a large list of fixed length numbers. He needs to sort this list using an efficient technique. Which of the following techniques can he use?
(a)Selection Sort (b)Radix Sort (c)Shell Sort (d)Quick Sort
51) A characteristic of data that binary search uses but linear search ignores is ANS:(A)
(a)order of the list (b)length of the list (c)maximum value of the list (d)None of these
52) Passage: integer MyVar1=5 function main()
{
integer MyVar1=9 print MyVar1
print //missing code
}
Assuming that main() is the starting point of execution of program, which of the following options should replace the
//missing code so as to print the value of global MyVar1 (value = ANS:(C) 5)?
(a)MyVar1.MyVar1 (b)MyVar1[0] (c) ::MyVar1 (d)No local variable should have the same name as the global variable
53) Which of the following options refers to the best case complexity of a Binary Search algorithm while searching a list of n elements?
(a) O(n*n) (b) O(log n) (c) O(n) (d)O (1)
54) Passage:
function Fibonacci(num)
1.if ( num equals 0 )
2.then return 1
3.else if ( n equals 1 )
4.then return 1
5.else return
Maya wrote the given algorithm to calculate Fibonacci series.
What is the complexity of this algorithm?
(a) O(n ) (b) O(n ) (c) O(n) (d) O(2 )
55) CPoansssiadgeer :the following
{
private: integer a, b public: integer c
function entity( ) { a = 0; b=0} function compare ( )
{ if (a>b) return 1; return 0
}
}
function main ( )
{
entity black
int value, value2 = 5
value = black.compare( ) // Statement 1 black.c = value2 //Statement 2
print black.a //Statement 3
}
Choose the correct answer. A
(a)Statement 1 (b)Statement 2 (c)Statement 3 (d)None of these
56) What will be the input to the second pass, if the list before starting the Radix Sort is: 729, 150, 123, 931, 348, 517?
(a)150, 123, 348, 517, 729, 931 (b)150, 931, 123, 517, 348, 729 (c)517, 729, 123, 931, 348, 150 (d)123, 150, 348, 517, 729, 931
56) In the following sorting procedures, which one will be the slowest for any given array? (a)Quick sort (b)Heap sort (c)Merge Sort (d)Bubble sort
29th answer please!!
ReplyDeleteall answers please!!
ReplyDeletewhere are the answers to these questions?????????
ReplyDelete39 c
ReplyDelete