Java Programming (3350703) MCQs

MCQs of Object Oriented Programming Concepts

Showing 11 to 20 out of 35 Questions
11.

"this" keyword represents a  _______?

("this" કીવર્ડ _______ દર્શાવે છે.)

(a)

object

(ઓબ્જેક્ટ)

(b)

method

(મેથડ)

(c)

constructor

(કન્શટ્રક્ટર)

(d)

reference variable

(રેફરેન્સ વેરીએબલ)

Answer:

Option (d)

12.

What will be the output of follwing code?

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

(a)

Welcome to heaven

(b)

welcome

(c)

to heaven

(d)

compilation error

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

Answer:

Option (a)

13.

Which of the following keyword makes variable belongs to class rather than being defined for each instance of the class?

(નીચેનામાંથી કયો કીવર્ડ વેરીએબલ બનાવે છે તે ક્લાસના દરેક ઇન્સ્ટન્શ માટે ડિફાઇન થવાને બદલે ફક્ત ક્લાસને જ બીલોંગ કરે છે?)

(a)

final

(b)

static 

(c)

Both final and static

(final અને static બંને)

(d)

None of given

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

Answer:

Option (b)

14.

We cannot use static keyword with _________.

(static કીવર્ડ સાથે ________ નો ઉપયોગ ન કરી શકાય.)

(a)

method

(મેથડ)

(b)

variable

(વેરીએબલ)

(c)

constructor

(કન્શટ્રક્ટર)

(d)

None of given

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

Answer:

Option (c)

15.

What will be the output of following code?

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

(a)

20   10

(b)

20   20

(c)

10   10

(d)

10   20

Answer:

Option (d)

16.

What will be the output of following code?

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

(a)

compilation error

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

(b)

runtime error

(રનટાઈમ એરર)

(c)

20

(d)

garbage value

(ગાર્બેજ વેલ્યુ)

Answer:

Option (a)

17.

Which of following statement is incorrect?

(નીચે આપેલ સ્ટેટમેન્ટ માંથી કયું ખોટું છે?)

(a)

If you make a class final then you cannot extend it.

(જો ક્લાસને final બનાવવામાં આવે તો તેને એક્સટેન્ડ ન કરી શકાય.)

(b)

Value of final variable cannot be changed once initialized.

(final વરીએબલ ની વેલ્યુ એકવખત ઇનીસીએલાઈઝ કર્યા પછી ચેન્જ ન કરી શકાય)

(c)

Constructor can be declared as final.

(કન્શટ્રક્ટર ને final ડીકલેર કરી શકાય.)

(d)

Final method is inherited but we cannot override it.

(final મેથડ ને ઇન્હેરીટ કરી શકાય પરંતુ ઓવરરાઈડ ન કરી શકાય.)

Answer:

Option (c)

18.

State true or false: In Method overloading, methods with different return types and different number of parameters are allowed. 

આપેલ વિધાન સાચું છે કે ખોટું: મેથડ ઓવરલોડીંગમા જુદી-જુદી રીટર્ન ટાઈપ અને જુદા-જુદા પેરેમીટરની સંખ્યા સાથેની મેથડ હોય શકે છે.

(a)

True

(b)

False

Answer:

Option (a)

19.

Implicit return type of constructor is ______________.

(કન્શટ્રક્ટર ની ઈમ્પલીસીટ રીટર્ન ટાઈપ ___________ છે.)

(a)

void

(b)

There is no return type

(તેમાં રીટર્ન ટાઈપ હોતી નથી)

(c)

Class object in which it is defined

(ક્લાસ ઓબ્જેક્ટ કે જેમાં તે ડિફાઇન હોય)

(d)

None of given

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

Answer:

Option (c)

20.

What should be the execution order, if a class has a method, static block, instance block and constructor?

(જો ક્લાસમાં મેથડ, static બ્લોક, ઇન્સ્ટન્શ બ્લોક અને કન્સટ્રક્ટર હોય તો તેના એક્ઝીક્યુશનનો ઓર્ડર શું હોવો જોઈએ?

(a)

Method, constructor, instance block and static block

(મેથડ, કન્શટ્રક્ટર, ઇન્સ્ટન્શ બ્લોક અને સ્ટેટિક બ્લોક)

(b)

Static block, instance block, constructor and method

(સ્ટેટિક બ્લોક,  ઇન્સ્ટન્શ બ્લોક, કન્શટ્રક્ટર અને મેથડ)

(c)

Static block, method, instance block and constructor

(સ્ટેટિક બ્લોક, મેથડ, ઇન્સ્ટન્શ બ્લોક અને કન્શટ્રક્ટર)

(d)

Instance block, method, static block and constructor

(ઇન્સ્ટન્શ બ્લોક, મેથડ, સ્ટેટિક બ્લોક અને કન્શટ્રક્ટર)

Answer:

Option (b)

Showing 11 to 20 out of 35 Questions