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 15

Arrays in Java are implemented as?

class

object

variable

none of the mentioned

SHOW ANSWER

Which of these keywords is used to prevent content of a variable from being modified?

final

last

constant

static

SHOW ANSWER

Which of these cannot be declared static?

class

object

variable

method

SHOW ANSWER

Which of the following statements are incorrect?

static methods can call other static methods only

static methods must only access static data

 static methods can not refer to this or super in any way

when object of class is declared, each object contains its own copy of static variables

SHOW ANSWER

Which of the following statements are incorrect?

Variables declared as final occupy memory

final variable must be initialized at the time of declaration

Arrays in java are implemented as an object

All arrays contain an attribute-length which contains the number of elements stored in the array

SHOW ANSWER

Which of these methods must be made static?

main()

delete()

run()

finalize()

SHOW ANSWER

What is the output of this program?
    class Output 
    {
        public static void main(String args[])
        {
            int arr[] = {1, 2, 3, 4, 5};
            for ( int i = 0; i < arr.length - 2; ++i)
                System.out.println(arr[i] + " ");
        } 
    }

a)1 2
b) 1 2 3
c) 1 2 3 4
d) 1 2 3 4 5
128. What is the output of this program?
    class Output 
    {
        public static void main(String args[])
        {
            int a1[] = new int[10];
            int a2[] = {1, 2, 3, 4, 5};
            System.out.println(a1.length + " " + a2.length);
        } 
    }

10 5

5 10

0 10

0 5

SHOW ANSWER

String in Java is a?

class

object

variable

character array

SHOW ANSWER

Which of these method of String class is used to obtain character at specified index?

char()

Charat()

charat()

charAt()

SHOW ANSWER

Which of these keywords is used to refer to member of base class from a subclass?

upper

super

this

none of the mentioned

SHOW ANSWER

Which of these method of String class can be used to test to strings for equality?

isequal()

isequals()

equals()

equal()

SHOW ANSWER

Which of the following statements are incorrect?

String is a class

Strings in java are mutable

Every string is an object of class String

Java defines a peer class of String, called StringBuffer, which allows string to be altered
SHOW ANSWER

What is the output of this program?
    class string_demo 
    {
        public static void main(String args[])
        {
            String obj = "I" + "like" + "Java";   
            System.out.println(obj);     
        }
   }

I

like

Java

IlikeJava

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