Which of these class object can be used to form a dynamic array?
What is the output of this program?
1.import java.util.*;
2.class date {
3.public static void main(String args[]) {
4.Date obj = new Date();
5.System.out.print(obj);
6.}
7.}
Which of these tranfer protocol must be used so that URL can be accessed by URLConnection class object?
In the below code, which call to sum() method is appropriate?
1.class Output {
2.public static int sum(int ...x)
3.{
4.return;
5.}
6.static void main(String args[])
7.{
8.sum(10);
9.sum(10,20);
10.sum(10,20,30);
11.sum(10,20,30,40);
12.}
13.}
What is the output of this program?
1.class Output {
2.public static void main(String args[]) {
3.Integer i = new Integer(257);
4.byte x = i.byteValue();
5.System.out.print(x);
6.}
7.}
Which of these class relies upon its subclasses for complete implementation of its methods?
What is the output of this program?
1.import java.net.*;
2.class networking {
3.public static void main(String[] args) throws MalformedURLException {
4.URL obj = new URL("http://www.sanfoundry.com/javamcq");
5.System.out.print(obj.getProtocol());
6.}
7.}
What does URL stands for?
Which of these methods is used to check for infinitely large and small values?
Which of these keywords can be used to prevent inheritance of a class?
Which of these is a process of writing the state of an object to a byte stream?
Which of these is an incorrect array declaration?
What is the output of this program?
1.import java.util.*;
2.class Linkedlist {
3.public static void main(String args[]) {
4.LinkedList obj = new LinkedList();
5.obj.add("A");
6.obj.add("B");
7.obj.add("C");
8.obj.removeFirst();
9.System.out.println(obj);
10.}
11. }
Which of these method of Object class can generate duplicate copy of the object on which it is called?
What is the output of this program?
1.class output {
2.public static void main(String args[])
3. {
4.StringBuffer c = new StringBuffer("Hello");
5.StringBuffer c1 = new StringBuffer(" World");
6.c.append(c1);
7.System.out.println(c);
8.}
9. }
Which of these method of class String is used to remove leading and trailing whitespaces?
What is the output of this program? 1.class Output {
2.public static void main(String args[]) {
3.long start, end;
4.start = System.currentTimeMillis();
5.for (int i = 0; i < 10000000; i++);
6.end = 7.System.currentTimeMillis();
System.out.print(end - start);
8.}
9.}
Which of the following is incorrect statement about packages?
Which of these class is used for operating on request from the client to the server?
What is the output of this program? 1.class Output {
2.public static void main(String args[])
3.{
4.boolean a = true;
5.boolean b = false;
6.boolean c = a ^ b;
7.System.out.println(!c);
8.}
9.}
What is the output of this program?
1.class output {
2.public static void main(String args[])
3. {
4.StringBuffer c = new StringBuffer("Hello");
5.StringBuffer c1 = new StringBuffer(" World");
6.c.append(c1);
7.System.out.println(c);
8.}
9. }
What is the output of this program?
1.import java.util.*;
2.class Array {
3.public static void main(String args[]) {
4.int array[] = new int [5];
5.for (int i = 5; i > 0; i--)
6.array[5 - i] = i;
7.Arrays.sort(array);
8.for (int i = 0; i < 5; ++i)
9.System.out.print(array[i]);;
10.}
11.}
What will s2 contain after following lines of code?
StringBuffer s1 = “one”;
StringBuffer s2 = s1.append(“two”)
Which of these object stores association between keys and values?
What is the output of this program?
1.import java.util.*;
2.class Output {
3.public static void main(String args[]) {
4.TreeSet t = new TreeSet();
5.t.add("3");
6.t.add("9");
7.t.add("1"); 8.t.add("4"); t.add("8");
9.System.out.println(t);
10.}
11.}
-
-
-
-
Which of these method is a rounding function of Math class?
What is the output of this program?
1.class String_demo {
2.public static void main(String args[])
3.{
4.int ascii[] = { 65, 66, 67, 68};
5.String s = new String(ascii, 1, 3);
6.ystem.out.println(s);
7.}
8.}
Which of the following package stores all the standard java classes?
Which of the following is incorrect statement about packages?
What is the order of precedence (highest to lowest) of following operators?
1. &
2. ^
3. ?:
What is the output of this program?
1.class box {
2.int width;
3.int height;
4.int length;
5.}
6.class mainclass {
7.public static void main(String args[])
8.{
9.box obj = new box();
10.System.out.println(obj);
11.}
12.}
What is the output of this program?
1.import java.util.*;
2.class stack {
3.public static void main(String args[]) {
4.Stack obj = new Stack();
5.obj.push(new Integer(3));
6.obj.push(new Integer(2));
7.obj.pop();
8.obj.push(new Integer(5));
9.System.out.println(obj);
10.}
11.}
What is the output of this program?
1.import java.net.*;
2.class networking {
3.public static void main(String[] args) throws Exception {
4.URL obj = new URL("http://www.sanfoundry.com/javamcq");
5.URLConnection obj1 = obj.openConnection();
6.System.out.print(obj1.getContentType());
7.}
8.}
Which of these class is superclass of String and StringBuffer class?
Which of these class is not related to input and output stream in terms of functioning?
What is the output of this program?
1.import java.util.*;
2.class Array {
3.public static void main(String args[]) {
4.int array[] = new int [5];
5.for (int i = 5; i > 0; i--)
6.array[5 - i] = i;
7.Arrays.sort(array);
8.for (int i = 0; i < 5; ++i)
9.System.out.print(array[i]);;
10.}
11.}
Which of these method of httpd class is used to write UrlCacheEntry object into local disk?
What is the output of this program?
1.class operators {
2.public static void main(String args[])
3.{
4.int var1 = 5;
5.int var2 = 6;
6.int var3;
7.var3 = ++ var2 * var1 / var2 + var2;
8.System.out.print(var3);
9.}
10.}
Which of these methods of httpd class is used to read data from the stream?
What is the output of this program?
1.import java.util.*;
2.class Array {
3.public static void main(String args[]) {
4.int array[] = new int [5];
5.for (int i = 5; i > 0; i--)
6.array[5 - i] = i;
7.Arrays.sort(array);
8.System.out.print(Arrays.binarySearch(9.array, 4));
10.}
11.}