import java.util.*;
class
hashtable{
public static void main(String
args[]){
Hashtable obj = new
Hashtable();
obj.put("A",new
Integer(3));
obj.put("B",new
Integer(2));
obj.put("C",new
Integer(8));
obj.remove(new
String("A"));
System.out.print(obj);
}
}
Ans: {C=8, B=2}
Consider
the following Schema?
STUDENTS(student_code,
first_name,last_name, email, phone_no, date_of_birth, honours_subject,
percentage_of_marks); Which of the following query would display names and
percentage of marks of all students
stored by honours subject,and then order by percentage of marks?
Ans: (a) Select first_name, lastname, hours_subject,
percentage_of_marks from students order by honours_subject,percentage_of_marks.
Which of
the following statements are incorrect?
Ans: Strings in java are mutable.
Which
statements is true for request.getSession(true) method?
Ans: getSession(true)
method always returns a new session
In HTTP Request method Get request is secured
because data is exposed in URL bar?
Ans: False
JDK stands for
Java Development Kit
import
java.util.*;
public class
Test{
public static void main(String
args[]){
System.out.println(new
Test().mystery("DELIVER"));
}
public String mystery(String s){
String s1 = s.substring(0,1);
String s2 =
s.substring(1,s.length()-1);
String
s3=s.substring(s.length()-1);
if(s.length()<=3)
return
s3+s2+s1;
else return
s1+mystery(s2)+s3;
}
}
Ans: DEVILER
import
java.util.*;
public class
Test{
public static int intValue;
public static void main(String
args[]){
System.out.println(intValue);
}
}
Ans: 0
FileOutputStream
is meant for writing streams of_ _ _ _ _
_
Ans: raw bytes
What is the
return type of reverse() method in StringBuffer class?
Ans: StringBuffer
Which of these
is an incorrect array declaration?
Ans: (d) int
arr[] = int [5] new
_ _ _ _ is
used to compare equality of two Strings
Ans: equals() method of Strong class
Which of these
statements can skip processing remaining of code in this its body for a
particular iteration?
Ans: continue
New drivers
can be plugged-in to the JDBC API without changing the client code.
Ans: TRUE
What exception
is thrown by read() method of InputStreamReader?
Ans: IOException
JAVA_HOME
points to which directory?
Ans: JDK Installation directory.
In which
package can we found DataInputStream class?
Ans: java.io
Is write()
method in BufferedWriter Class overloaded?
Ans: TRUE
Which of the
following is implemented by OutputStream class?
Ans: All of the mentioned. (closeable,
flushable,autocloseable)
import
java.util.*;
public class
Test{
public static void main(String
args[]){
int num=10;
switch(num);
}
}
Ans: Compiler Error
JDk7
introduced a new version of the try statement known as____
Ans: try-with-resources statement
Which of these
exception is thrown in cases when the file specified for writing it not found?
Ans: FileNotFoundExcepion
public void
foo(boolean a, boolean b){
if(a)
{
System.out.println("A");
// line 5
}else if(a&&b){
//line 7
System.out.println("A&&B");
}else{ // line 11
if(!b){
System.out.println("notB");
}else{
System.out.println("ELSE");
}
}
}
ANS: If a is false and b is true then the output is
“ELSE”