Java Programming (3350703) MCQs

MCQs of Object Oriented Programming Concepts

Showing 1 to 10 out of 35 Questions
1.

Which of the following is correct for class?

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

(a)

Class can have only methods and cannot declare variables.

(ક્લાસમા ફક્ત મેથડ હોય શકે અને વેરીએબલ ડીકલેર ન કરી શકાય.)

(b)

Class can have both methods and variables.

(ક્લાસમા મેથડ અને વેરીએબલ બંને હોય શકે)

(c)

Class is not implementation of abstract data type(ADT).

(ક્લાસએ એબ્સટ્રેક્ટ ડેટાટાઈપ (ADT) નું ઈમ્પલીમેન્ટેશન નથી)

(d)

None of given

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

Answer:

Option (b)

2.

State true or false: Each instance of the class contains its own copy of declared variables within class.

(આપેલ વિધાન સાચું છે કે ખોટું: ક્લાસના દરેક ઇન્સ્ટન્સમા ક્લાસમા ડીકલેર કરેલ વેરીએબલની પોતાની કોપી હોય છે.)

(a)

True

(b)

False

Answer:

Option (a)

3.

Which operator is used to create object of class in java?

(Javaમા ક્લાસનો ઓબ્જેક્ટ બનાવવા માટે ક્યા ઓપરેટરનો ઉપયોગ થાય છે?)

(a)

scope resolution

(સ્કોપ રીઝોલ્યુશન)

(b)

new

(c)

:

(d)

None of given

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

Answer:

Option (b)

4.

What will be the output of following code?

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

(a)

10  10

(b)

10  20

(c)

20  20

(d)

20  10

Answer:

Option (c)

5.

What is the process by which we can control which parts of a program can access the members of a class?

(કઈ પ્રોસેસને લીધે આપણે પ્રોગ્રામના ક્યા પાર્ટમા ક્લાસના ક્યા મેમ્બરને એક્સેસ કરી શકીએ છીએ તેને કંટ્રોલ કરી શકાય?)

(a)

Polymorphism

(પોલીમોર્ફીઝમ)

(b)

Encapsulation

(એન્કેપ્સ્યુલેશન)

(c)

Abstraction

(એબ્સટ્રેક્શન)

(d)

None of given

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

Answer:

Option (b)

6.

Which of the following is very less restrictive access specifier?

(નીચે આપેલમાંથી કયો વિકલ્પ સૌથી ઓછું રેસ્ટ્રીક્ટીવ એક્સેસ સ્પેસીફાઈર છે?)

(a)

private

(b)

protected

(c)

public

(d)

None of given

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

Answer:

Option (c)

7.

Which of following statement is incorrect?

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

(a)

private members of class can only be accessed by other members of the class

(ક્લાસના private મેમ્બર ફક્ત ક્લાસના બીજા મેમ્બર દ્વારા જ એક્સેસ થઇ શકે છે)

(b)

public members of class can be accessed by any code in the program

(ક્લાસના public મેમ્બર પ્રોગ્રામમાં કોઈપણ કોડ દ્વારા એક્સેસ થઇ શકે છે)

(c)

protected members of a class can be inherited by a subclass and become private members of the subclass

(સબ-ક્લાસ દ્વારા ક્લાસના protected મેમ્બર ને ઇન્હેરીટ કરી શકાય અને તે સબ-ક્લાસ ના private મેમ્બર બને છે)

(d)

private members of class can be inherited by a subclass and become protected members in subclass

(સબ-ક્લાસ દ્વારા ક્લાસના private મેમ્બર ને ઇન્હેરીટ કરી શકાય અને તે સબ-ક્લાસમા protected મેમ્બર બને છે)

Answer:

Option (d)

8.

A variable or method declared without any access control modifier is available _________.

(વેરીએબલ અથવા મેથડ કે જેને કોઈપણ એક્સેસ કંટ્રોલ મોડીફાયર વગર ડીકલેર કરેલ હોય તે _______ મા એક્સેસ થઈ શકે છે.)

(a)

to any other class in the same package

(એ જ પેકેજના કોઈપણ ક્લાસ મા)

(b)

to any other class in the different package

(જુદા-જુદા પેકેજના કોઈપણ ક્લાસમા)

(c)

to any other class in the same package and in the different package

(એ જ પેકેજના અને જુદા-જુદા પેકેજના કોઈપણ ક્લાસમા)

(d)

None of given

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

Answer:

Option (a)

9.

What will be the output of following code?

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

(a)

compilation error

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

(b)

runtime error

(રનટાઈમ એરર)

(c)

10

(d)

None of given

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

Answer:

Option (a)

10.

"this" keyword can not be used in ______?

("this" કીવર્ડ નો ઉપયોગ _________ મા ન કરી શકાય.)

(a)

Non static methods

(નોન-સ્ટેટિક મેથડ)

(b)

constructor

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

(c)

static block and method

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

(d)

None of given

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

Answer:

Option (c)

Showing 1 to 10 out of 35 Questions