Java Programming (3350703) MCQs

MCQs of Building Blocks of the Language

Showing 11 to 20 out of 51 Questions
11.

What will be the output of following code?

(નીચે આપેલ કોડ નું આઉટપુટ શું આવશે?)

(a)

256

(b)

46

(c)

45

(d)

44

Answer:

Option (d)

12.

What will be the output of following code?

(નીચે આપેલ કોડનું આઉટપુટ શું આવશે?)

(a)

-128

(b)

128

(c)

126

(d)

compilation error

(કમ્પાઈલેશન એરર)

Answer:

Option (a)

13.

What will be the output of following code?

(નીચે આપેલ કોડનું આઉટપુટ શું આવશે?)

(a)

2

(b)

20

(c)

0

(d)

compilation error

(કમ્પાઈલેશન એરર)

Answer:

Option (c)

14.

In java, dynamically allocated memory is release using ____________.

(Java મા ડાયનેમિકલી અલોકેટ થયેલ મેમરી રીલીઝ કરવા ________ નો ઉપયોગ થાય છે.)

(a)

garbage collection

(ગાર્બેજ કલેક્શન)

(b)

delete operator

(ડીલીટ ઓપરેટર)

(c)

Both garbage collection and delete operator

(ગાર્બેજ કલેક્શન અને ડીલીટ ઓપરેટર બંને)

(d)

None of given

(આપલેમાંથી એકપણ નહિ)

Answer:

Option (a)

15.

Which of the following is not wrapper class?

(નીચે આપેલમાંથી કયો wrapper (વ્રેપર) class નથી?)

(a)

Double

(b)

Integer

(c)

Vector

(d)

Float

Answer:

Option (c)

16.

Which of following statement is true to convert any datatype to string in java?

(નીચે આપેલમાંથી કયું સ્ટેટમેન્ટ કોઈપણ ડેટાટાઈપ માંથી સ્ટ્રીંગમા કન્વર્ટ કરવા માટે સાચું છે?)

(a)

toStrings()

(b)

Strings.valueof()

(c)

String.valueOf()

(d)

string.valueof()

Answer:

Option (c)

17.

Which of the following statement is used to declare one dimension array?

(નીચે આપેલમાંથી ક્યા સ્ટેટમેન્ટનો ઉપયોગ એક ડાયમેન્શન એરે ડીકલેર કરવા માટે થાય છે?)

(a)

int a = new int();

(b)

int a[] = new int[size];

(c)

int a = new int[size];

(d)

int a[] = new int(size);

Answer:

Option (b)

18.

Which method of String class is used to compare two String objects for their equality?

(String ક્લાસ ની કઈ મેથડ બે સ્ટ્રીંગ ઓબ્જેક્ટ સરખા છે કે નહિ તેને કમ્પેર કરવા માટે ઉપયોગ થાય છે?)

(a)

Equals()

(b)

equal()

(c)

equals()

(d)

isEqual()

Answer:

Option (c)

19.

Which datatype value returned by equals() method of String class?

(String ક્લાસ ની equals() મેથડ કઈ ડેટાટાઈપ ની વેલ્યુ રીટર્ન કરે છે?)

(a)

int

(b)

char

(c)

String

(d)

boolean

Answer:

Option (d)

20.

What will be the output of the following code?

(નીચે આપેલ કોડ નું આઉટપુટ શું આવશે?)

(a)

truefalse

(b)

falsefalse

(c)

truetrue

(d)

falsetrue

Answer:

Option (a)

Showing 11 to 20 out of 51 Questions