Sunteți pe pagina 1din 10

Technical Ability Test

1. What will be the output of the program?


String x = new String("xyz");
String y = "abc";
x = x + y;
How many String objects have been created?
A. 2

B. 3

C. 4

D. 5
Ans . B

2. Which collection class allows you to grow or shrink its size and provides indexed access to
its elements, but whose methods are not synchronized?
A. java.util.HashSet

B. java.util.LinkedHashSet

C. java.util.List

D. java.util.ArrayList
Ans : D

3. Which of the following are Java reserved words?


1. 1) run
2. 2) import
3. 3) default
4. 4) implement
A. 1 and 2

B. 2 and 3

C. 3 and 4

D. 2 and 4
Ans B
4.

public interface Foo


{
int k = 4; /* Line 3 */
}
Which three piece of codes are equivalent to line 3?
1. final int k = 4;
2. public int k = 4;
3. static int k = 4;
4. abstract int k = 4;
5. volatile int k = 4;
6. protected int k = 4;
A. 1, 2 and 3

B. 2, 3 and 4

C. 3, 4 and 5

D. 4, 5 and 6
Ans- A
5.

class Boo
{
Boo(String s) { }
Boo() { }
}
class Bar extends Boo
{
Bar() { }
Bar(String s) {super(s);}
void zoo()
{
// insert code here
}
}
which one create an anonymous inner class from within class Bar?
A. Boo f = new Boo(24) { };

B. Boo f = new Bar() { };

C. Bar f = new Boo(String s) { };


D. Boo f = new Boo.Bar(String s) { };
Ans – B
6.

public class Outer


{
public void someOuterMethod()
{
//Line 5
}
public class Inner { }

public static void main(String[] argv)


{
Outer ot = new Outer();
//Line 10
}
}
Which of the following code fragments inserted, will allow to compile?
A. new Inner(); //At line 5

B. new Inner(); //At line 10

C. new ot.Inner(); //At line 10

D. new Outer.Inner(); //At line 10


Ans.
7. Which one creates an instance of an array?
A. int[ ] ia = new int[15];

B. float fa = new float[20];

C. char[ ] ca = "Some String";

D. int ia[ ] [ ] = { 4, 5, 6 }, { 1,2,3 };


Ans. a

8. What will be the output of the program?


try
{
int x = 0;
int y = 5 / x;
}
catch (Exception e)
{
System.out.println("Exception");
}
catch (ArithmeticException ae)
{
System.out.println(" Arithmetic Exception");
}
System.out.println("finished");

A. finished

B. Exception

C. Compilation fails.

D. Arithmetic Exception

Ans . c
9. Which two of the following are legal declarations for nonnested classes and interfaces?
1. 1) final abstract class Test {}
2. 2) public static interface Test {}
3. 3) final public class Test {}
4. 4) protected abstract class Test {}
5. 5) protected interface Test {}
6. 6) abstract public class Test {}
A. 1 and 4

B. 2 and 5

C. 3 and 6

D. 4 and 6
Ans -c
10. Which of the following class level (nonlocal) variable declarations will not compile?
A. protected int a;

B. transient int b = 3;

C. private synchronized int e;

D. volatile int d;
Ans C
11. When does method overloading is determined?
a) At run time
b) At compile time
c) At coding time
d) At execution time
Ans. B
12. Which concept of Java is achieved by combining methods and attribute into a class?
a) Encapsulation
b) Inheritance
c) Polymorphism
d) Abstraction
Ans . a

13. What will be the value of t if a = 56 , b = 876?

Read a,b
Function mul(a, b)
t=0
while (b != 0)
t=t+a
b=b-1
End While
return t;
End Function

a) 490563
b) 49056
c) 490561
d) None of the mentioned

Ans: Option B

14. How many times the following loop be executed?

{

ch = ‘b’;
while(ch >= ‘a’ && ch <= ‘z’)
ch++;
}

a) 0
b) 25
c) 26
d) 1

Ans: B

15. Consider the following piece of code. What will be the space required for this code?

int sum(int A[], int n)


{
int sum = 0, i;
for(i = 0; i < n; i++)
sum = sum + A[i];
return sum;
}
// sizeof(int) = 2 bytes

a) 2n + 8
b) 2n + 4
c) 2n + 2
d) 2n

Ans: A
Numerical Ability Test

1. Today is Monday. After 61 days, it will be:


A. Wednesday

B. Saturday

C. Tuesday

D. Thursday
Ans – B

2. A motorboat, whose speed in 15 km/hr in still water goes 30 km downstream and comes back in
a total of 4 hours 30 minutes. The speed of the stream (in km/hr) is:
A. 4

B. 5

C. 6

D. 10
Ans B
3. A, B and C can do a piece of work in 20, 30 and 60 days respectively. In how many days can
A do the work if he is assisted by B and C on every third day?
A. 12 days

B. 15 days

C. 16 days

D. 18 days
Ans B
4. If a person walks at 14 km/hr instead of 10 km/hr, he would have walked 20 km more. The
actual distance travelled by him is:
A. 50 km

B. 56 km

C. 70 km

D. 80 km
Ans A
5.
6, 9, 15, 21, 24, 28, 30 … Find odd man out -
A. 28

B. 21

C. 24
D. 30
Ans A
6.

A 300 metre long train crosses a platform in 39 seconds while it crosses a signal pole in 18 seconds.
What is the length of the platform?
A. 320 m

B. 350 m

C. 650 m

D. Data inadequate
Ans. B
7. Statement: Should India encourage exports, when most things are insufficient for internal use
itself?
Arguments:
I. a) Yes. We have to earn foreign exchange to pay for our imports.
II. b) No. Even selective encouragement would lead to shortages.
A. Only argument I is strong

B. Only argument II is strong

C. Either I or II is strong

D. Neither I nor II is strong

E. Both I and II are strong


Ans : A
HTML and CSS

1. What is the correct HTML element for the inserting a line break ?
a) <lb>
b) <break>
c) <br>
d) <break/>
Ans : C
2. What is the correct HTML for adding a background color ?
a) <background>yellow</background>
b) <body bg="yellow">
c) <body style="background-color:yellow;">
d) <body style="bg-color:red;">
Ans : C
3. What is the correct HTML for making a text area?
a) <textarea>
b) <input type=”textarea”>
c) <input type=”textbox”>
d) <textbox>
Ans: A
4. How do you make the text bold?
a) font:bold;
b) style:bold;
c) font-weight:bold;
d) Styles:bold

Ans: C

5. Which CSS property is used to change the text color of an element?


a) fgcolor
b) color
c) text-color
d) font-color

Ans: B

6. What is the correct HTML for making a drop-down list?


a) <select >
b) <input type=”list>
c) <list>
d) <input type=”dropdown”>
7. Which HTML attribute is used to define inline styles?
a) class
b) style
c) script
d) font
Ans : B
Database
1. Which SQL statement is used to create a table in a database?
a) CREATE DATABASE TABLE
b) CREATE DATABASE TAB
c) CREATE DB
d) CREATE TABLE
Ans D
2. Which operator is used to select values within a range?
a) RANGE
b) BETWEEN
c) WITHIN
d) LIKE
Ans B
3. What is the most common type of join?
a) INNER JOIN
b) INSIDE JOIN
c) JOINED
d) JOINED TABLE
Ans a
4. With SQL, how can you return the number of records in the "Persons" table?
a) SELECT COUNT(*) FROM Persons
b) SELECT NO(*) FROM Persons
c) SELECT LEN(*) FROM Persons
d) SELECT COLUMNS(*) FROM Persons
Ans a
5. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
a) INSERT INTO Persons ('Olsen') INTO LastName
b) INSERT INTO Persons (LastName) VALUES ('Olsen')
c) INSERT ('Olsen') INTO Persons (LastName)
d) INSERT INTO Persons VALUES ('Olsen')
Ans : B
6. Which SQL statement is used to return only different values?
a) SELECT DIFFERENT
b) SELECT UNIQUE
c) SELECT DISTINCT
d) SELECT COMMON
Ans C

S-ar putea să vă placă și