What is the output of this program?
1.import java.io.*;
2.class files {
3.public static void main(String args[]) {
4.File obj = new File("/java/system");
5.System.out.print(obj.getName());
6.}
7.}
Which of these is correct about passing an argument by call-by-value process?
Which of these method of class StringBuffer is used to concatenate the string representation to the end of invoking string?
Which of these class is used to create an object whose character sequence is mutable?
Which of these is a method to clear all the data present in output buffers?
What is the output of this program?
1.import java.util.*;
2.class hashtable {
3.public static void main(String args[]) {
4.Hashtable obj = new Hashtable();
5.obj.put("A", new Integer(3));
6.obj.put("B", new Integer(2));
7.obj.put("C", new Integer(8));
8.obj.remove(new String("A"));
9.System.out.print(obj);
10.}
11.}
What is the output of this program?
1.class equality {
2.int x;
3.int y;
4.boolean isequal(){
5.return(x == y);
6.}
7.}
8.class Output {
9.public static void main(String args[])
10.{
11.equality obj = new equality();
12.obj.x = 5;
13.obj.y = 5;
14.System.out.println(obj.isequal());
15.}
16.}
What is the output of this program?
1.import java.io.*;
2.class filesinputoutput {
3.public static void main(String args[]) {
4.InputStream obj = new FileInputStream("inputoutput.java"); 5.System.out.print(obj.available());
6.}
7.}
Note: inputoutput.java is stored in the disk.
What is the output of this program?
1.class access{
2.public int x;
3.private int y;
4.void cal(int a, int b){
5.x = a + 1;
6.y = b;
7.}
8.void print() {
9.system.out.println(" " + y);
10.}
11.}
12.class access_specifier {
13.public static void main(String args[])
14.{
15.access obj = new access();
16.obj.cal(2, 3);
17.System.out.println(obj.x);
18.obj.print();
19.}
20.}
Which of these method of MimeHeader is used to return the string equivalent of the values stores on MimeHeader?
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 the following package stores all the standard java classes?
What is the output of this program?
1.class char_increment {
2.public static void main(String args[])
3.{
4.char c1 = 'D';
5.char c2 = 84;
6.c2++;
7.c1++;
8.System.out.println(c1 + " " + c2);
9.}
10.}
Which of these classes is not included in java.lang?
What will s2 contain after following lines of code?
String s1 = “one”;
String s2 = s1.concat(“two”)
What is the output of this program?
1.class Abc
2.{
3.public static void .main(String[]args)
4.{
5.String[] elements = { "for", "tea", "too" };
6.String first = (elements.length > 0) ? elements[0]: null;
7.}
8.}
Which of these is a super class of wrappers Long, Character & Integer?
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.addFirst("D");
9.System.out.println(obj);
10.}
11.}
-
-
-
-
What is the output of this program?
1.class String_demo {
2. public static void main(String args[])
3.{
4.char chars[] = {'a', 'b', 'c'};
5.String s = new String(chars);
6.System.out.println(s);
7.}
8.}
Which of these jump statements can skip processing remainder of code in its body for a particular iteration?
Which of these method of InputStream is used to read integer representation of next available byte input?
What is the output of this program?
1.class Output {
2.public static void main(String args[]) {
3.double x = 3.1;
4.double y = 4.5;
5.double z = Math.max( x, y );
6.System.out.print(z);
7.}
8.}
What is the output of this program?
1.class array_output {
2.public static void main(String args[])
3.{
4.int array_variable [] = new int[10];
5.for (int i = 0; i < 10; ++i) {
6.array_variable[i] = i/2;
7.array_variable[i]++;
8.System.out.print(array_variable[i] + " ");
9. i++;
10.}
11.}
12.}
What is the output of this program?
1.class Output {
2.public static void main(String args[]) {
3.byte a[] = { 65, 66, 67, 68, 69, 70 };
4.byte b[] = { 71, 72, 73, 74, 75, 76 };
5.System.arraycopy(a , 0, b, 0, a.length);
6.System.out.print(new String(a) + " " + new String(b));
7.}
8.}
Which of these is an on correct statement?
What is the output of this program?
1.class San
2.{
3.San()throws IOException
4.{
5.}
6.}
7.class Foundry extends San
8.{
9.Foundry()
10.{
11.}
12.public static void 13.main(String[]args)
14.{
15.}
16.}
What is the output of this program? 1.class string_class {
2.public static void main(String args[])
3.{
4.String obj = "I LIKE JAVA";
5.System.out.println(obj.charAt(3));
6.}
7.}
What is the output of this program?
1.class test {
2.int a;
3.int b;
4.test(int i, int j) {
5.a = i;
6.b = j;
7.}
8.void meth(test o) {
9.a *= 2;
10.O.b /= 2;
11.}
12.}
13.class Output {
14.public static void main(String args[])
15.{
16.test obj = new test(10 , 20);
17.obj.meth(obj);
18.System.out.println(obj.a + " " + obj.b);
19.}
20.}
What is the output of this program?
1.import java.io.*;
2.class files {
3.public static void main(String args[]) {
4.File obj = new File("/java/system");
5.System.out.print(obj.getAbsolutePath());
6.}
7.}
Note: file is made in c drive.
Which of these is a class which uses String as a key to store the value in object?
What is the output of this program?
1.class A {
2.int i;
3.int j;
4.A() {
5.i = 1;
6. j = 2;
7.}
8.}
9.class Output {
10.public static void main(String args[])
11.{
12.A obj1 = new A();
13.System.out.print(obj1.toString());
14.}
15.}
Modulus operator, %, can be applied to which of these?
Which of these method is used to make a bit zero specified by the index?
What does URL stands for?
What is the output of this program?
1.import java.util.*;
2.class Bitset {
3.public static void main(String args[]) {
4.BitSet obj = new BitSet(5);
5.for (int i = 0; i < 5; ++i)
6.obj.set(i);
7.System.out.print(obj.get(3));
8.}
9.}
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.}
Which of these method is used to reduce the capacity of an ArrayList object?
What is the output of this program?
1.package pkg;
2.class display {
3.int x;
4.void show() {
5.if (x > 1)
6.System.out.print(x + " ");
7.}
8.}
9.class packages {
10.public static void main(String args[]) {
11.display[] arr=new display[3];
12.for(int i=0;i<3;i++)
13.arr[i]=new display();
14.arr[0].x = 0;
15.arr[1].x = 1;
16.arr[2].x = 2;
17.for (int i = 0; i < 3; ++i)
18.arr[i].show();
19.}
20.}
Which of these keywords is used to prevent content of a variable from being modified?
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.int len = obj1.getContentLength();
7.System.out.print(len);
8.}
Note: Host URL is having length of content 127.