Welcome Guest

Aptitude And Technical Questions for ANSHIN SOFTWARE

Q. No. :1
Question :A bag contains 3 white, 5 blue and 4 green balls. If two balls are drawn at random from the bag, then find the probability that both the balls are of same colour?
A :
19/66
B :
18/66
C :
12/66
D :
17/66
Answer: A
Q. No. :2
Question :The odds in favour of a player being selected for the national team with three independent selectors are 4:3, 2:1 and 1:4 respectively. What is the probability that of the three selectors a majority will be favourable?
A :
2/5
B :
10/21
C :
6/35
D :
2/21
Answer: B
Q. No. :3
Question :In a right angled triangle, the larger of the sides containing the right angle is 8cm longer than the smaller of the sides. The sum of the lengths of the sides containing the right angle is 16cm more than the length of the other side. Find the length (in cm) of the smallest side.
A :
18
B :
12
C :
24
D :
16
Answer: C
Q. No. :4
Question :A person bought a certain number of oranges for Rs 7. If the prices of each orange was Rs 2 less, he would have bought 4 more oranges for the same amount. Find the number of oranges he bought originally.
A :
12
B :
10
C :
18
D :
15
Answer: B
Q. No. :5
Question :A test had 200 question. each correct answer carries 2 marks. each wrong answer carried (-1/2) marks and unanswered question carried no mark. Ajay attempted all the question in the test and scored 360 marks. What would his marks be, if for each correct answer he got only 1/2 mark and for each wrong answer he lost 2  marks?
A :
80
B :
100
C :
60
D :
120
Answer: C
Q. No. :6
Question :If Ashok travelled at 4/5 th of his usual speed, he would reach his destination 15 minutes late. By how much minutes would he be early if he travelled at 6/5 th of his usual speed?
A :
12
B :
10
C :
15
D :
16
Answer: B
Q. No. :7
Question :There are 30 mango trees, 40 guava trees and 50 apple trees. The trees are planted in such a way that each row of trees contains trees of the same variety and every row contains an equal number of trees. Find the minimum number of rows in which all the trees could be planted.
A :
9
B :
10
C :
11
D :
12
Answer: D
Q. No. :8
Question :Two men or 5 women can complete a piece of work in 15 days. In how many days can 4 men and 5 women complete the same work?
A :
7
B :
4
C :
6
D :
5
Answer: D
Q. No. :9
Question :Vijay plays a game, wherein he tosses a coin and scores 9 points if heads turns up and 5 points if tails turns up. A total of exactly 182 points is required to win the game. In how many combinations of heads and tails can Vijay win?
A :
6
B :
5
C :
4
D :
3
Answer: C
Q. No. :10
Question :The sum of present ages of a mother and her daughter is 60 years. When the mother attains her husband's present age, the ratio of her husband's age and her daughter's age would be 2:1. Find the present age of the daughter.
A :
15
B :
20
C :
10
D :
18
Answer: B
Q. No. :11
Question :
 
public class MyRunnable implements Runnable 
{
    public void run() 
    {
        // some code here
    }
}
which of these will create and start this thread?
A :
new Runnable(MyRunnable).start();
B :
new Thread(MyRunnable).run();
C :
new Thread(new MyRunnable()).start();
D :
new MyRunnable().start();
Answer: C
Solution
Q. No. :12
Question :
 
public Object m() 
{  
    Object o = new Float(3.14F); 
    Object [] oa = new Object[l];
    oa[0] = o; /* Line 5 */
    o = null;  /* Line 6 */
    oa[0] = null; /* Line 7 */
    return o; /* Line 8 */
}
When is the Float object, created in line 3, eligible for garbage collection?
A :
just after line 5
B :
just after line 6
C :
just after line 7
D :
just after line 8
Answer: C
Solution
Q. No. :13
Question :You need to store elements in a collection that guarantees that no duplicates are stored and all elements can be accessed in natural order. Which interface provides that capability?
A :
java.util.Map
B :
java.util.Set
C :
java.util.List
D :
java.util.Collection
Answer: B
Solution
Q. No. :14
Question :What will be the output of the program?
 
int i = 1, j = 10; 
do 
{
    if(i++ > --j) /* Line 4 */
    {
        continue; 
    } 
} while (i < 5); 
System.out.println("i = " + i + "and j = " + j); /* Line 9 */

A :
i = 6 and j = 5
B :
i = 5 and j = 5
C :
i = 6 and j = 6
D :
i = 5 and j = 6
Answer: D
Solution
Q. No. :15
Question :What will be the output of the program?
 
public class Foo 
{  
    public static void main(String[] args) 
    {
        try 
        { 
            return; 
        } 
        finally 
        {
            System.out.println( "Finally" ); 
        } 
    } 
}

A :
Finally
B :
Compilation fails
C :
The code runs with no output.
D :
An exception is thrown at runtime.
Answer: A
Solution
Q. No. :16
Question :Which cannot directly cause a thread to stop executing?
A :
Calling the SetPriority() method on a Thread object.
B :
Calling the wait() method on an object.
C :
Calling notify() method on an object.
D :
Calling read() method on an InputStream object.
Answer: C
Solution
Q. No. :17
Question :You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective?
A :
Public
B :
Private
C :
Protected
D :
default access
Answer: D
Solution
Q. No. :18
Question :Which two can be used to create a new Thread?
1.Extend java.lang.Thread and override the run() method.
2.Extend java.lang.Runnable and override the start() method.
3.Implement java.lang.Thread and implement the run() method.
4.Implement java.lang.Runnable and implement the run() method.
5.Implement java.lang.Thread and implement the start() method.
A :
1 and 2
B :
2 and 3
C :
1 and 4
D :
3 and 4
Answer: C
Solution
Q. No. :19
Question :What is the name of the method used to start a thread execution?
A :
init();
B :
start();
C :
run();
D :
resume();
Answer: B
Solution
Q. No. :20
Question :Which two of the following methods are defined in class Thread?
  1. start()
  2. wait()
  3. notify()
  4. run()
  5. terminate()
A :
1 and 4
B :
2 and 3
C :
3 and 4
D :
2 and 4
Answer: A
Solution
Q. No. :21
Question :
 
/* Missing Statement ? */
public class foo 
{
    public static void main(String[]args)throws Exception 
    {
        java.io.PrintWriter out = new java.io.PrintWriter(); 
        new java.io.OutputStreamWriter(System.out),true); 
        out.println("Hello"); 
    } 
}
What line of code should replace the missing statement to make this program compile?
A :
No statement required.
B :
import java.io.*;
C :
include java.io.*;
D :
import java.io.PrintWriter;
Answer: A
Solution
Q. No. :22
Question :What will be the output of the program?
 
String s = "ABC"; 
s.toLowerCase(); 
s += "def"; 
System.out.println(s);

A :
ABC
B :
abc
C :
ABCdef
D :
Compile Error
Answer: C
Solution
Q. No. :23
Question :Suppose that you would like to create an instance of a new Map that has an iteration order that is the same as the iteration order of an existing instance of a Map. Which concrete implementation of the Map interface should be used for the new instance?
A :
TreeMap
B :
HashMap
C :
LinkedHashmap
D :
The answer depends on the implementation of the existing instance.
Answer: C
Solution
Q. No. :24
Question :Assume the following method is properly synchronized and called from a thread A on an object B:
wait(2000);
After calling this method, when will the thread A become a candidate to get another turn at the CPU?
A :
After thread A is notified, or after two seconds.
B :
After the lock on B is released, or after two seconds.
C :
Two seconds after thread A is notified.
D :
Two seconds after lock B is released.
Answer: A
Solution
Q. No. :25
Question :What is the value of "d" after this line of code has been executed?
 double d = Math.round ( 2.5 + Math.random( ));

A :
2
B :
3
C :
4
D :
2.5
Answer: B
Solution
Q. No. :26
Question :What will be output if you will execute following c code?
#include{     char ch=321;  
  printf("%d %c",ch,ch);  
  return 0 ;
}

A :
321, #
B :
65, A
C :
321, !
D :
66, B
Answer: B
Q. No. :27
Question :What is the output of a following program?
 #define ADD(x)=x + x
 #define SUB(x)=x - x
int main()
{ int y= ADD(x)/SUB(x);
printf("%d", ADD(y));
}

A :
Divide by zero exception at runtime
B :
1
C :
2
D :
-2
Answer: C
Q. No. :28
Question :What is the difference between the functions memcpy and memmove?
A :
memcpy is declared in <string.h> and memmove is declared in  <stdlib.h>.
B :
memcpy copies the string whereas memmove copies as well as move the strings.
C :
memcpy is for non-overlapping memory areas whereas memmove can be used for overlapping memory areas.
D :
memcpy is portable whereas memmove is non-portable.
Answer: C
Q. No. :29
Question :What is the output of the following program?
 int main() {
char arr[30]="hello";
char *p= arr;
(*p)++;
printf("%s,", p );
p++;
printf("%s",p);
}

A :
ello, iello
B :
iello, ello
C :
hello, ello
D :
ello, hello
Answer: B
Q. No. :30
Question :What is the output of the following program?
 int main()
{
int i=5, j=2;
printf("%d %d", i << j, i >> j);
}

A :
16,1
B :
20,1
C :
1,16
D :
1,20
Answer: B
Q. No. :31
Question :Which of the following is not a memory area in an executable C program?
A :
Stack area
B :
Queue area
C :
Heap area
D :
Code area
Answer: B
Q. No. :32
Question :Which of the following sentence is the correct description for the following declaration?
 void(*x[10]) ();

A :
x is an array[10] of pointer to function returning type void.
B :
x is an array[10] of pointer to function returning type void*.
C :
x is an array of ten function returning type void.
D :
x is a pointer to an array of ten pointer to function returning type void.
Answer: A
Q. No. :33
Question :Which of the following best describes volatile keyword?
A :
Volatile keyword indicate that the variable is stored in volatile memory.
B :
Volatile keyword indicate that the value of the variable cannot be determined at compile-time.
C :
Volatile keyword instructs the compiler not to do any optimizations on that variable.
D :
Volatile keyword indicate that it cannot be used with constant keyword.
Answer: C
Q. No. :34
Question :Identify the correct statement regarding scope of variables
A :
Global variables are declared in a separate file and accessible from any program.
B :
Local variables are declared inside a function and accessible within the function only.
C :
Global variables are declared inside a function and accessible from anywhere in program.
D :
Local variables are declared in the main body of the program and accessible only from functions.
Answer: B
Q. No. :35
Question :Observe the following block of code and determine what happens when x=2?
 

switch (x){

case 1:

case 2:

case 3:

                cout<< "x is 3, so jumping to third branch";

                goto thirdBranch;

default:

                cout<<"x is not within the range, so need to say Thank You!";

                }


A :
Program jumps to the end of switch statement since there is nothing to do for x=2
B :
The code inside default will run since there is no task for x=2, so, default task is run
C :
Will display x is 3, so jumping to third branch and jumps to third Branch.
D :
None of above
Answer: C
Q. No. :36
Question :

Find out the error in following block of code.

If (x = 100)

Cout << “x is 100”;

A :
100 should be enclosed in quotations
B :
There is no semicolon at the end of first line
C :
Equals to operator mistake
D :
Variable x should not be inside quotation
Answer: C
Q. No. :37
Question :Examine the following program and determine the output
 

#include <iostream>

using namespace std;

int operate (int a, int b)

{

                return (a * b);

}

float operate (float a, float b)

{

                return (a/b);

}

int main()

{

                int x=5, y=2;

                float n=5.0, m=2.0;

                cout << operate(x,y) <<"\t";

cout << operate (n,m);

return 0;

}


A :
10.0, 5.0
B :
5.0, 2.5
C :
10.0, 5
D :
10, 2.5
Answer: D
Q. No. :38
Question :Consider the following declaration
 n=2;
if(n <=10)
{
stmt 1;
stmt 2;
}
else
{
stmt 3;
stmt 4;
}
If time required to execute if loop is O(2) and the else part is O(2) then what will be the total execution time?
A :
O(2)
B :
O(4)
C :
O(3)
D :
None of these
Answer: A
Q. No. :39
Question :In an n-node binary tree traversal, what is the total number of steps required for a  full traversal?
A :
n
B :
n-1
C :
2(n-1)
D :
2n
Answer: C
Q. No. :40
Question :Which of the following permutations can be obtained in the output (in the same order) using a stack assuming that the input is a sequence 1,2,3,4,5in that order?
A :
3,4,5,1,2
B :
3,4,5,2,1
C :
1,5,2,3,4
D :
5,4,3,1,2
Answer: B
Q. No. :41
Question :Suppose T is binary search tree. which of the following statements about T is TRUE?
A :
Preorder traversal of T will yield a sorted listing of the elements of T.
B :
Inorder traversal of T will yield a sorted listing of the elements of T.
C :
Postorder traversal of T will yield a sorted listing of the elements of T.
D :
Inorder traversal as well as Postorder traversal of T will yield a sorted listing the elements of T.
Answer: B
Q. No. :42
Question :Which of the following statements are correct?
(i). A stack may be viewed as descending priority queue.
(ii).A queue may be viewed as descending priority queue.
(iii).A queue may be viewed as ascending priority queue.
(iv).A stack may be viewed as ascending priority queue.
A :
(i), (ii)
B :
(i),(iii)
C :
(ii),(iv)
D :
(iii),(iv)
Answer: B
Q. No. :43
Question :When Inorder traversing a tree resulted
E A C K F H D B G; the preorder traversal would return?
A :
F A E K C D B H G
B :
F A E K C D H G B 
C :
E A F K H D C B G
D :
F E A K D C H B G
Answer: B
Q. No. :44
Question :Suppose that the internal bit string representation of a key is
010111001010110 and 5 bits are allowed in the index.
What will be the hash value by using folding method? 
A :
01111
B :
11110
C :
01011
D :
10101
Answer: A
Q. No. :45
Question :Suppose a relation has a degree of 7 and cardinality of 15. How many attributes(A) does this relation have and how many different rows (R) are currently present in the relation?
A :
A=7, R=15
B :
A=15, R=7
C :
A=6, R=14
D :
A=14, R=6
Answer: A
Q. No. :46
Question :In __________ strategy a transaction is not allowed to modify the physical database until the undo portion of the log is written to stable storage.
A :
centralized log
B :
write-back-log
C :
write-ahead-log
D :
None of these
Answer: C
Q. No. :47
Question :Consider the following functional dependencies in a database
D -->A, A--> E, N-->R, R-->N, C-->Cn, C-->I
(R,C)-->G
The relation (R,N,D,A) is
A :
in 2NF but not in 3NF
B :
in 3NF but not in BCNF
C :
in BCNF
D :
None of these
Answer: A
Q. No. :48
Question :We have the following relation schemas :
Patient(patient_name,patient_addr,Treating_doctor);
Hospitalcharges(patient_name,hospitalchargeid,typeofcharge,amount);
Doctorcharges(patient_name,doctorchargeid,typeofchargeid,amount)
Suppose we have query as,
(SELECT patient_name FROM doctorcharges)
EXCEPTALL
(SELECT patient_name FROM hospitalcharges)
If Jones has 3 doctorcharge bill and 1 hospitalcharge bill, how many tuples with the name Jones in the result?
A :
4 tuples
B :
3 tuples
C :
2 tuples
D :
1 tuples
Answer: C
Q. No. :49
Question :Which of the following cannot be a triggering event for a trigger?
A :
INSERT
B :
DELETE
C :
UPDATE
D :
None of these
Answer: D
Q. No. :50
Question :State which of the following is True or False?
(i). The value of NULL is ignored in any aggregation.
(ii). NULL is treated as an ordinary value in a grouped attribute.
A :
True, True
B :
True, False
C :
False, True
D :
False, False
Answer: A