You are on page 1of 6

============================================

Question 1
============================================

Which of the following can be used to terminate a while loop and transfer control
outside the loop?
1. exit while
2. continue
3. exit statement
4. break
5. goto

Choice :
A. 1, 3
B. 2, 4
C. 3, 5
D. 4, 5

============================================
Question 2
============================================

Which of the following is true about return type of functions in C?

Choice :
A. Functions can return any type
B. Functions can return any type except array and functions
C. Functions can return any type except array, functions and union
D. Functions can return any type except array, functions, function pointer and
union

============================================
Question 3
============================================

How many stacks are needed to implement a queue. Consider the situation where no
other data structure like arrays, linked list is available to you

Choice :
A. 1
B. 2
C. 3
D. 4

============================================
Question 4
============================================

#include<iostream>
using namespace std;

class X
{
public:
int x;
};

int main()
{
X a = {10};
X b = a;
cout << a.x << \" \" << b.x;
return 0;
}

Choice :
A. Compiler Error
B. 10 followed by Garbage Value
C. 10 10
D. 10 0

============================================
Question 5
============================================

What does the following function print for n = 25?


void fun(int n)
{
if (n == 0)
return;

printf(\"%d\", n%2);
fun(n/2);
}

Choice :
A. 11001
B. 10011
C. 11111
D. 00000

============================================
Question 6
============================================

Predict the output


#include<iostream>
using namespace std;
class A
{
int i;
public:
A(int ii = 0) : i(ii) {}
void show() { cout << i << endl; }
};

class B
{
int x;
public:
B(int xx) : x(xx) {}
operator A() const { return A(x); }
};

void g(A a)
{
a.show();
}
int main()
{
B b(10);
g(b);
g(20);
return 0;
}

Choice :
A. Compiler Error
B. 10 20
C. 20 20
D. 10 10

============================================
Question 7
============================================

Minimum number of temporary variable needed to swap the contents of 2 variable is ?

Choice :
A. 1
B. 2
C. 3
D. 0

============================================
Question 8
============================================

find the output of the program?


class Base { int x = 10; }
class Derived extends Base
{ int x = 20; }
Base b = new Base();
Derived d = new Derived ( );
Base bd = new Derived();
The statement
System.out.println(b.x + \" \" + d.x + \" \" + bd.x);

Choice :
A. 10 20 20
B. 10 20 10
C. 20 10 20
D. 20 20 10

============================================
Question 9
============================================

What is the result of executing the following code when the value of x is 2:
switch (x) {
case 1:
System.out.println(1);
case 2:
case 3:
System.out.println(3);
case 4:
System.out.println(4);
}

Choice :
A. Nothing is printed out
B. The value 3 is printed out
C. The values 3 and 4 are printed out
D. The values 1, 3 and 4 are printed out

============================================
Question 10
============================================

What is the result of executing the following code, using the parameters 4 and 0:
public void divide(int a, int b) {
try {
int c = a / b;
} catch (Exception e) {
System.out.print(\"Exception \");
} finally {
System.out.println(\"Finally\");
}

Choice :
A. Prints out: Exception Finally
B. Prints out: Finally
C. Prints out: Exception
D. No output

============================================
Question 11
============================================

A certain sum of money amounts to Rs 1008 in 2 years and to Rs 1164 in 3 and half
years. Find the sum and the rate of interest

Choice :
A. 800, 14%
B. 800, 13%
C. 800, 12%
D. 800, 19%

============================================
Question 12
============================================

A man takes 6 hours 15 minutes in walking a distance and riding back to the
starting place. He could walk both ways in 7 hours 45 minutes. The time taken by
him to ride both ways, is 7. A man takes 6 hours 15 minutes in walking a distance
and riding back to the starting place. He could walk both ways in 7 hours 45
minutes. The time taken by him to ride both ways, is

Choice :
A. 4 hours
B. 4 hours 30 minutes
C. 4 hours 45 minutes
D. 5 hours

============================================
Question 13
============================================

Two trains A and B start simultaneously in the opposite direction from two points P
and Q and arrive at their destinations 16 and 9 hours respectively after their
meeting each other. At what speed does the second train B travel if the first train
travels at 120 km/h

Choice :
A. 90 km/h
B. 160 km/h
C. 67.5 km/h
D. None of these

============================================
Question 14
============================================

A fruit basket contains more apples than lemons.There are more lemons in the basket
than there are oranges.The basket contains more apples than oranges.If the first
two statements are true, the third statement is

Choice :
A. true
B. false
C. uncertain
D. none

============================================
Question 15
============================================

Pointing to a person, a man said to a woman, \"His mother is the only daughter of
your father.\" How was the woman related to the person ?

Choice :
A. Aunt
B. Mother
C. Wife
D. Daughter

============================================
Question 16
============================================

A father said his son , \" I was as old as you are at present at the time of your
birth.\" If the father age is 38 now, the son age 5 years back was

Choice :
A. 14
B. 19
C. 33
D. 38

============================================
Question 17
============================================

Tanya is older than Eric.


Cliff is older than Tanya.
Eric is older than Cliff.
If the first two statements are true, the third statement is

Choice :
A. true
B. false
C. uncertain
D. none

============================================
Question 18
============================================

If 2 tables and 3 chairs cost Rs, 3500 and 3 tables and 2 chairs cost Rs. 4000,
then how much does a table cost ?

Choice :
A. 500
B. 1000
C. 1500
D. 2000

============================================
Question 19
============================================

A fires 5 shots to B\s 3 but A kills only once in 3 shots while B kills once in 2
shots. When B has missed 27 times, A has killed :

Choice :
A. 30 birds
B. 60 birds
C. 72 birds
D. 90 birds

============================================
Question 20
============================================

A vessel is filled with liquid, 3 parts of which are water and 5 parts of syrup.
How much of the mixture must be drawn off and replaced with water so that the
mixture may be half water and half syrup?

Choice :
A. 1/3
B. 1/5
C. 1/4
D. 1/6

You might also like