Java Fundamentals
Java Fundamentals
Name:
E-Mail:
Mobile:
int X = 10 ;
int Y = X << 2 ;
Answer:
int X = 16 ;
int Y = X ^ 32 ;
Answer:
Q. What is the value of Z after the following expressions are
evaluated?
int X = 32 ;
long Y = 16 ;
int Z=X*Y;
a. 48
b. 512
c. This will not compile
Q. Consider the following list. What is the expression that will give
the number of elements in this list?
Answer:
Q. Is the following statement a valid method declaration:
a. Yes b. No
a. Yes b. No
Q. Consider the following class and choose the correct answer from
the options given below.
public class TestClass
{
private int number ;
private TestClass()
{
number = 10 ;
}
Answer:
Q. Declare a Set (that can hold a set of values of type String) and
add two elements to it.
Answer:
Q. Declare an array that can hold a set of numbers and initialise it
with numbers from 1 to 10.
Answer:
Answer:
Q. Write the statement that will put a thread to sleep for 2 seconds.
Answer:
Answer:
Q. Consider the following class:
Answer:
Answer:
Answer:
Q. Write a method that will take the text file name as argument and
return the number of lines in it.