Inheritance: 38 MCQs

All 38 multiple-choice questions from this kit, free and with no sign-up.

Warm-up · 20 questions

Q1. Inheritance માં 'is-a' સંબંધનો અર્થ શું છે?

Beginner
A એક class બીજા class નો ઉપયોગ કરે છે
B એક class બીજા class નો ભાગ છે
C એક class બીજા class ને બનાવે છે
D એક class બીજા class નો પ્રકાર છે

Answers and explanations are in the Veda app.

Q2. નીચેનામાંથી કયો Inheritance નો પ્રકાર નથી?

Beginner
A Hierarchical Inheritance
B Single Inheritance
C Multilevel Inheritance
D Double Inheritance

Answers and explanations are in the Veda app.

Q3. Child class parent class ના કયા members ને વારસામાં મેળવી શકતો નથી?

Beginner
A બધા members ને વારસામાં મેળવી શકે છે
B Protected members
C Public members
D Private members

Answers and explanations are in the Veda app.

Q4. નીચેનામાંથી કયો સંબંધ Inheritance માટે યોગ્ય છે?

Beginner
A Student અને Course
B Cat અને Animal
C Car અને Engine
D Book અને Page

Answers and explanations are in the Veda app.

Q5. Multilevel Inheritance માં કેટલા levels હોઈ શકે છે?

Beginner
A માત્ર ત્રણ
B માત્ર એક
C માત્ર બે
D કોઈ મર્યાદા નથી, પરંતુ ઊંડી hierarchy ટાળવી જોઈએ

Answers and explanations are in the Veda app.

Q6. Java ભાષા Multiple Inheritance ને કેવી રીતે સપોર્ટ કરે છે?

Beginner
A Interfaces નો ઉપયોગ કરીને
B ફક્ત single inheritance ને જ સપોર્ટ કરે છે
C તે Multiple Inheritance ને બિલકુલ સપોર્ટ કરતી નથી
D સીધા જ બહુવિધ classes માંથી વારસો મેળવીને

Answers and explanations are in the Veda app.

Q7. Inheritance નો ઉપયોગ કરતી વખતે સૌથી મહત્વપૂર્ણ શું છે?

Beginner
A ફક્ત એક જ level નો ઉપયોગ કરવો
B Code ને ફરીથી લખવાનું ટાળવું
C બધા members public હોવા જોઈએ
D 'is-a' સંબંધ હોવો જોઈએ

Answers and explanations are in the Veda app.

Q8. નીચેનામાંથી કયું વિધાન Inheritance વિશે સાચું છે?

Beginner
A Inheritance polymorphism ને સમર્થન આપે છે
B Inheritance હંમેશા code ને સરળ બનાવે છે
C Inheritance નો ઉપયોગ ફક્ત GUI frameworks માં થાય છે
D Inheritance માં child class parent class ના બધા members ને બદલી શકે છે

Answers and explanations are in the Veda app.

Q9. જો 'Vehicle' parent class છે અને 'Car', 'Bike', 'Truck' child classes છે, તો આ કયા પ્રકારનો Inheritance છે?

Beginner
A Hierarchical Inheritance
B Multiple Inheritance
C Multilevel Inheritance
D Single Inheritance

Answers and explanations are in the Veda app.

Q10. Inheritance નો ઉપયોગ કરીને તમે શું પ્રાપ્ત કરી શકો છો?

Beginner
A ફક્ત data hiding
B Code reusability અને polymorphism
C ફક્ત polymorphism
D ફક્ત code reusability

Answers and explanations are in the Veda app.

Q11. ખૂબ ઊંડી inheritance hierarchy ની શું સમસ્યા છે?

Beginner
A તે code ને જટિલ અને સમજવામાં મુશ્કેલ બનાવે છે
B તે code ને વધુ ઝડપી બનાવે છે
C તે compiler ને ધીમું કરે છે
D તે memory નો વધુ ઉપયોગ કરે છે

Answers and explanations are in the Veda app.

Q12. Inheritance ફક્ત code reusability માટે ઉપયોગી છે.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q13. Child class parent class ના private members ને વારસામાં મેળવી શકે છે.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Q14. Inheritance શું છે? સમજાવો.

Beginner

Answers and explanations are in the Veda app.

Q15. Parent class અને Child class વચ્ચે શું સંબંધ છે?

Beginner

Answers and explanations are in the Veda app.

Q16. Single Inheritance નું ઉદાહરણ આપો.

Beginner

Answers and explanations are in the Veda app.

Q17. Multilevel Inheritance નું ઉદાહરણ આપો.

Beginner

Answers and explanations are in the Veda app.

Q18. Hierarchical Inheritance નું ઉદાહરણ આપો.

Beginner

Answers and explanations are in the Veda app.

Q19. Inheritance નો મુખ્ય ફાયદો શું છે?

Beginner

Answers and explanations are in the Veda app.

Q20. Child class parent class ના કયા members ને વારસામાં મેળવી શકતો નથી?

Beginner

Answers and explanations are in the Veda app.

Building up · 11 questions

Q21. Multiple Inheritance શું છે? તેની મર્યાદા શું છે?

Intermediate

Answers and explanations are in the Veda app.

Q22. Inheritance અને Composition વચ્ચે શું તફાવત છે?

Intermediate

Answers and explanations are in the Veda app.

Q23. GUI Frameworks માં Inheritance નો ઉપયોગ કેવી રીતે થાય છે?

Intermediate

Answers and explanations are in the Veda app.

Q24. Polymorphism સાથે Inheritance નો શું સંબંધ છે?

Intermediate

Answers and explanations are in the Veda app.

Q25. Game Development માં Inheritance નો ઉપયોગ કેવી રીતે થાય છે?

Intermediate

Answers and explanations are in the Veda app.

Q26. Data Structures માં Inheritance નો ઉપયોગ કેવી રીતે થાય છે?

Intermediate

Answers and explanations are in the Veda app.

Q27. નીચેનામાંથી કયો સંબંધ Inheritance (વારસા) માટે સૌથી યોગ્ય છે?

Intermediate
A Book (પુસ્તક) અને Library (પુસ્તકાલય) વચ્ચેનો સંબંધ
B Dog (કૂતરો) અને Animal (પ્રાણી) વચ્ચેનો સંબંધ
C Car (કાર) અને Engine (એન્જિન) વચ્ચેનો સંબંધ
D Student (વિદ્યાર્થી) અને School (શાળા) વચ્ચેનો સંબંધ

Answers and explanations are in the Veda app.

Q28. જો Parent Class 'Vehicle' (વાહન) માં 'startEngine()' અને 'stopEngine()' methods છે, અને Child Class 'Car' (કાર) માં 'openTrunk()' method ઉમેરવામાં આવે છે, તો 'Car' class ના ઑબ્જેક્ટ પર નીચેનામાંથી કઈ method કૉલ કરી શકાય છે?

Intermediate
A માત્ર 'openTrunk()'
B માત્ર 'startEngine()' અને 'stopEngine()'
C 'startEngine()', 'stopEngine()' અને 'openTrunk()' ત્રણેય
D માત્ર 'startEngine()' અને 'openTrunk()'

Answers and explanations are in the Veda app.

Q29. Multilevel Inheritance માં, જો 'Vehicle' → 'Car' → 'SportsCar' એક hierarchy છે, તો 'SportsCar' class ના ઑબ્જેક્ટને કયા class(es) ના members મળે છે?

Intermediate
A 'SportsCar', 'Car' અને 'Vehicle' ત્રણેય class ના members
B 'SportsCar' અને 'Car' class ના members, પરંતુ 'Vehicle' class ના નહીં
C માત્ર 'SportsCar' class ના members
D માત્ર 'Vehicle' અને 'SportsCar' class ના members

Answers and explanations are in the Veda app.

Q30. નીચેનામાંથી કયું વિધાન Inheritance (વારસા) ના ઉપયોગ વિશે સાચું છે?

Intermediate
A Inheritance નો ઉપયોગ ફક્ત code reusability (કોડ પુનઃઉપયોગિતા) માટે થાય છે.
B Inheritance નો ખરો હેતુ classes વચ્ચે 'is-a' સંબંધને મોડેલ કરવાનો છે.
C Inheritance નો ઉપયોગ ફક્ત GUI frameworks માં જ થાય છે.
D Inheritance નો ઉપયોગ કરવાથી code હંમેશા સરળ અને ઓછો જટિલ બને છે.

Answers and explanations are in the Veda app.

Q31. જો 'Vehicle' parent class છે અને 'Car', 'Bike', 'Truck' એ બધા 'Vehicle' ના child classes છે, તો આ કયા પ્રકારનો Inheritance છે?

Intermediate
A Single Inheritance
B Hierarchical Inheritance
C Multiple Inheritance
D Multilevel Inheritance

Answers and explanations are in the Veda app.

Topper level · 7 questions

Q32. Inheritance નો ઉપયોગ કરતી વખતે શું ધ્યાન રાખવું જોઈએ?

Advanced

Answers and explanations are in the Veda app.

Q33. Inheritance નો ખરો હેતુ શું છે?

Advanced

Answers and explanations are in the Veda app.

Q34. ધારો કે તમારી પાસે નીચેનો Java code છે: ```java class Animal { protected String sound = "Generic sound"; public void makeSound() { System.out.println(sound); } } class Dog extends Animal { private String sound = "Bark"; @Override public void makeSound() { System.out.println(sound); } } public class Test { public static void main(String[] args) { Animal a = new Dog(); a.makeSound(); } } ``` આ code નું આઉટપુટ શું હશે?

Advanced
A Runtime error: field hiding causes ambiguity
B Generic sound
C Bark
D Compilation error: cannot override private field

Answers and explanations are in the Veda app.

Q35. નીચેના Java code ને ધ્યાનમાં લો: ```java class A { int x = 10; void display() { System.out.println("Class A: " + x); } } class B extends A { int x = 20; void display() { System.out.println("Class B: " + x); } } class C extends B { int x = 30; void display() { System.out.println("Class C: " + x); } } public class Main { public static void main(String[] args) { A obj = new C(); System.out.println(obj.x); obj.display(); } } ``` આ code નું આઉટપુટ શું હશે?

Advanced
A 10\nClass A: 10
B 10\nClass C: 30
C 10\nClass C: 30
D 30\nClass C: 30

Answers and explanations are in the Veda app.

Q36. ધારો કે તમારી પાસે નીચેનો Java code છે: ```java class Parent { public static void greet() { System.out.println("Hello from Parent"); } public void instanceMethod() { System.out.println("Parent instance"); } } class Child extends Parent { public static void greet() { System.out.println("Hello from Child"); } @Override public void instanceMethod() { System.out.println("Child instance"); } } public class Test { public static void main(String[] args) { Parent p = new Child(); p.greet(); p.instanceMethod(); } } ``` આ code નું આઉટપુટ શું હશે?

Advanced
A Hello from Child\nChild instance
B Hello from Parent\nChild instance
C Compilation error: cannot override static methods
D Hello from Parent\nParent instance

Answers and explanations are in the Veda app.

Q37. નીચેના Java code ને ધ્યાનમાં લો: ```java class Base { private int value = 10; public int getValue() { return value; } } class Derived extends Base { private int value = 20; public int getValue() { return value; } public int getBaseValue() { return super.getValue(); } } public class Test { public static void main(String[] args) { Derived d = new Derived(); System.out.println(d.getValue()); System.out.println(d.getBaseValue()); } } ``` આ code નું આઉટપુટ શું હશે?

Advanced
A 10\n10
B 20\n20
C Compilation error: cannot access private field in superclass
D 20\n10

Answers and explanations are in the Veda app.

Q38. ધારો કે તમારી પાસે નીચેનો Java code છે: ```java interface A { default void show() { System.out.println("A"); } } interface B { default void show() { System.out.println("B"); } } class C implements A, B { public void show() { A.super.show(); B.super.show(); System.out.println("C"); } } public class Test { public static void main(String[] args) { C obj = new C(); obj.show(); } } ``` આ code નું આઉટપુટ શું હશે?

Advanced
A A\nB\nC
B Compilation error: cannot resolve super in multiple inheritance
C C\nA\nB
D A\nC\nB

Answers and explanations are in the Veda app.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Paper Solver

Get Veda free See what students get

Free to start · Android app and web · More than 40 languages