Java Basics
Description: Concept based questions Java Basics | |
Number of Questions: 15 | |
Created by: Vijay Palan | |
Tags: Concept based questions Java Basics |
Which of the following statements is/are valid to create a server socket?
Which of the following exceptions is thrown by the Java compiler when we try to create a server socket on a port which is busy?
In Java network programming, which of the following statements is/are used by the client to request a connection to the server?
Which of the following methods is used to get the number of columns in a table?
In Java network programming, which of the following methods is/are defined in “InetAddress” class?
Which of the following methods is used to get the maximum number of columns that we can create in a table in Java database programming?
Which of the following is correct about the given statement?
Colour c1 = new Colour(284,60,189);
Which of the following methods is/are present in DatabaseMetadata interface in Java database programming?
Which of the following methods is present in ResultSetMetadata interface?
In Java networking, when a client socket cannot find a server, which of the following exceptions is thrown?
Which of the following methods is/are used by the web browser to control the applet?
class BitShift
{
public static
void main(String [] args)
{
int x = 0x80000000;
System.out.
print(x + " and ");
x = x >>> 31;
System.out.
println(x);
}
}
Which of the following methods will be used to execute the above SQL query in Java database programming?
String s = Select firstname, lastname from Employee;
Which of the following methods cannot be invoked from the instance of frame class in AWT?
public class If2
{
static boolean b1, b2;
public static void main(String [] args)
{
int x = 0;
if ( !b1 ) /* Line 7 */
{
if ( !b2 ) /* Line 9 */ { b1 = true;
x++; if ( 5 > 6 )
{
x++;
}
if ( !b1 ) x = x + 10;
else if ( b2 = true ) /* Line 19 */ x = x + 100;
else if ( b1 | b2 ) /* Line 21 */ x = x + 1000;
}
} System.out.println(x);
}
}
Which of the following methods is not necessary to define a class if it implements the windowListener interface?
public void test(int x)
{
int odd = 1;
if(odd)
{
System.out.println("odd");
}
else
{
System.out.println("even");
}
}
Which of the following event types is invalid in Java?
class Equals
{
public static
void main(String [] args)
{
int x = 100;
double y = 100.1;
boolean b = (x = y);
/* Line 7 */ System.out.println(b);
}
}