Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

JAVA QUESTIONS : PART 16

What is the output of this program?
    class string_class 
    {
        public static void main(String args[])
        {
            String obj = "hello";
            String obj1 = "world";   
            String obj2 = obj;
            obj2 = " world";
            System.out.println(obj + " " + obj2);
        }
    }

hello hello

world world

hello world

world hello

SHOW ANSWER

What is the output of this program?
    class string_class 
    {
        public static void main(String args[])
        {
            String obj = "hello";
            String obj1 = "world";   
            String obj2 = "hello";
            System.out.println(obj.equals(obj1) + " " + obj.equals(obj2));
        }
    }

false false

true true

true false

false true

SHOW ANSWER

What is the process of defining more than one method in a class differentiated by parameters?

Method  overriding

Method  overloading

Method doubling

None of the mentioned

SHOW ANSWER

Which of these can be used to differentiate two or more methods having the same name?

Parameters data type

Number of parameters

Return type of method

All of the mentioned

SHOW ANSWER

Which of these data type can be used for a method having a return statement in it?

void

int

float

both int and float

SHOW ANSWER

Which of these statement is incorrect?

Two or more methods with same name can be differentiated on the basis of their parameters data type

Two or more method having same name can be differentiated on basis of number of parameters

Any already defined method in java library can be defined again in the program with different data type of parameters

If a method is returning a value the calling statement must have a variable to store that value

SHOW ANSWER

What is the output of this program?
    class box 
    {
        int width;
        int height;
        int length;
        int volume;
        void volume(int height, int length, int width) 
        {
             volume = width * height * length;
        } 
    }    
    class Prameterized_method{
        public static void main(String args[]) 
        {
            box obj = new box();
            obj.height = 1;
            obj.length = 5;
            obj.width = 5;
            obj.volume(3, 2, 1);
            System.out.println(obj.volume);        
        } 
    }

0

1

6

25

SHOW ANSWER

What is the output of this program?
    class equality 
    {
        int x;
        int y;
        boolean isequal()
        {
            return(x == y);  
        } 
    }    
    class Output 
    {
        public static void main(String args[]) 
        {
            equality obj = new equality();
            obj.x = 5;
            obj.y = 5;
            System.out.println(obj.isequal);
        } 
    }

false

true

0

1

SHOW ANSWER

What is the output of this program?
    class Output 
    {
        static void main(String args[]) 
        {    
             int x , y = 1;
             x = 10;
             if(x != 10 && x / 0 == 0)
                 System.out.println(y);
             else
                 System.out.println(++y);
        } 
    }

1

2

Runtime Error

Compilation Error

SHOW ANSWER

What is the output of this program?
    class area 
    {
        int width;
        int length;
        int height;
        area() 
        {
        width = 5;
        length = 6;
        height = 1;
        }
        void volume() 
        {
             volume = width * height * length;
        } 
    }    
    class cons_method 
    {
        public static void main(String args[]) 
        {
            area obj = new area();
            obj.volume();
            System.out.println(obj.volume);
        } 
   }

0

1

25

30

SHOW ANSWER

Which of this method is given parameter via command line arguments?

main()

recursive() method

Any method

System defined methods

SHOW ANSWER

Which of these data types is used to store command line arguments?

Array

Stack

String

Integer

SHOW ANSWER

How many arguments can be passed to main()?

Infinite

Only 1

System Dependent

None of the mentioned

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in