[go: up one dir, main page]

0% found this document useful (0 votes)
68 views11 pages

OOP Question Bank

Uploaded by

yojana patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views11 pages

OOP Question Bank

Uploaded by

yojana patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Subject Name: OOP in Java (BTCOC305)

Question Bank
Set 1(PT, Mid Questions)
1. Explain with neat labelled diagram typical java Development Environment.
2 .Explain following keywords: public. Static, void, main, String args [] also explain
Compilation &execution process with one Example.
3 .write short note on silent features of java.
4. Write a java code create class Student, instance variable name, roll number, age using create
and display method.
5. Explain Control statement in Java
6. Differentiate between Class &Object.
7. Differentiate between Primitive Data Type &Reference Data Type

8. Enlist Various Decision Making Statements &Explain in details

9. Write Short note on Primitive Data Type &Reference Data Type. .

10. Write a Java program to create a class Rectangle and Data members’ length and width
calculate area of rectangle using Method.

11. Write java code using for Switch Statement to check Vowel or Consonant:
12. Write java code using for Switch Statement to display 10 th Months with Number
13. Explain with neat labelled diagram typical java Development Environment.
14. Explain following keywords: public. Static, void, main, String args [] also explain
Compilation &execution process with one Example.
15. Write short note on silent features of java.
16. Write a java code create class Student, instance variable name, roll number, age using create
and display method.
17. Explain Control statement in Java.
18. Define inheritance. What are the benefits of inheritance? How to prevent a class from
inheritance?

19. Write a program to demonstrate hierarchical and multiple inheritance


Using interfaces.

20. Define polymorphism. Explain run time polymorphism with the help of Example.

21. What are the difference between error and exception? Explain with the help of example.
22. How to create user Defined exception.

Set 2(Question Paper2023)


.
Q. 1 Solve Any Two of the following. A) Explain different parts of a Java program with an
appropriate example (Application) 6
B) What are the advantages of the object-oriented programming language? (Understand) 6
C) List the primitive data types available in Java and explain. (Understand) 6

Q.2 Solve Any Two of the following. A) What are the benefits of break and continue
statements explain with example? (Analysis) 6
B) Discuss default constructor and parameterized constructor with the help of an example in
Java? (Application) 6
C) How do we implement polymorphism in JAVA? Explain briefly (Understand) 6
Q. 3 Solve Any Two of the following.
A) a) Write a program to find the smallest and largest number from given input array? For
example: Input: arr[]={13,4,2,5,9} Output : Maximum is 13 and Minimum is 2 (Application))
6
B) Write a program to check whether enter number is palindrome or not? (Application) 6
C) Write the differences between interface and abstract class (Understand) 6

Q.4 Solve Any Two of the following


A) Define inheritance. What are the benefits of inheritance? How to prevent a class from
inheritance? (Understand) 6
B) Write a program to demonstrate hierarchical and multiple inheritance using interfaces
(Understand) 6
C) Define polymorphism. Explain run time polymorphism with the help of example.
(Application) 6
Q. 5 solve any two of the following.
A) What is the difference between error and an exception? Explain with help of example
(Understand) 6

Set 3(Tutorial Question)


Q 1. How do we implement polymorphism in JAVA? Explain briefly
Q 2. Write Short Note On Access Modifiers.
Q.3. Write a Differences between Interface &Abstract Class.
Q. 4. Write a Differences between Method Overloading &Method Overriding.
Q. 5. Explain Types of Inheritance.

Q.6What are the benefits of break and continue statements explain with Example?
Q.7 Discuss default constructor and parameterized constructor with the help of an example in
Java?
Q8. What are the advantages of the object-oriented programming language?
Q9. Write a program to find the smallest and largest number from given Input array?
Input: arr[]={13,4,2,5,9}
Output: Maximum is 13 and Minimum is
Q10. Write a program to check whether enter number is palindrome or not?

Q11. Explain Types of Polymorphism.

Q12.How to handle exception in java.

Q13.Differentiate between Superclass&SubClass.

Q14. What are Abstract Classes .Explain with Example?

Set 4(MCQ)
Object Oriented Programming in Java MCQ with
Answers
1. Which of the following is an object encapsulated inside the
System class?
A) out
B) println
C) Both A and B
D) None of the above

2. Employee emp = ___ Employee (); Pick a suitable word from


the list so that an object of the class Employee is created.
A) object
B) class
C) run
D) new

3. What is the output for the following code: System.out.println


(“Hello World”);
A) Shows error
B) Hello World
C) “Hello World”
D) None of the above

4. ___ provides a standard interface to common system


resources.
A) new
B) API
C) System
D) None of the above

5. Which of the following is also known as SDK:


A) devkit
B) JVM
C) JDK
D) None of the above

6. Which feature of Java is used to dynamically link code in a safe


and expedient manner:
A) Secure
B) Distributed
C) Dynamic
D) Robust

7. Which of the following additional package is included by JDK:


A) java.awt
B) sun.addtools.debug
C) java.util
D) sun.tools.debug

8. Which among the following is not a feature of Java:


A) Portable
B) Structured
C) Distributed
D) High Performance

9. ___ is a Java run-time system that chooses to execute the JAVA


Bytecode:
A) SDK
B) JDK
C) JVM
D) None of the above

10. Which of the following operators are used to compare two


values and give the results:
A) Increment and Decrement
B) Logical
C) Comparison
D) Arithmetic

11. What is the result of the expression: 10+5*8-15/5


A) 3
B) 47
C) 7
D) 21

12. ___ is a common programming construct that is based upon a


sequence of nested if:
A) switch
B) nested if
C) if-else-if ladder
D) None of the above
13. ___ statement is Java’s multi-way branch statement.
A) switch
B) nested if
C) break
D) if-else-if ladder

14. Which loop always executes its body at least once, even
though the condition is not true:
A) for
B) do-while
C) while
D) continue

15. ___ is used to exit from a loop:


A) continue
B) quit
C) break
D) None of the above

16. Which of the following method can be used to set the size of
the buffer:
A) ensureCapacity( )
B) length( )
C) capacity( )
D) setLength( )

17. Which of the following method returns the reversed object on


which it is called:
A) insert( )
B) replace( )
C) delete( )
D) reverse( )

18. String indexes begin at:


A) 1
B) 3
C) 0
D) 2

19. Which of the following is a special operator to allocate


memory:
A) New
B) Old
C) ++
D) –

20. Both the String and StringBuffer classes are defined in ____
package:
A) java.awt
B) java.io
C) java.lang
D) java.util

21. Method used to extract a single character from a String:


A) toCharArray( )
B) getChars( )
C) getBytes( )
D) charAt( )

22. Human Being and Elephant fall under which of the following
relationship:
A) Kind-Of
B) Is-A
C) Part-Of
D) Has-A

23. Which of the following allows the creation of hierarchical


classifications?
A) Interface
B) Inheritance
C) Package
D) Polymorphism

24. A class member that has been declared as private will be ___
to its class.
A) Friendly
B) Public
C) Protected
D) Private

25. Which of the following keywords is used to prevent


inheritance:
A) final
B) catch
C) extends
D) super
26. Java supports ___ access specifiers.
A) 1
B) 2
C) 3
D) 4

27. ___ is used as a base class to derive specific classes of the


same kind.
A) private
B) friend class
C) abstract class
D) superclass

28. Writing the same code in different places, leading to


unnecessary replication of code:
A) Code extensibility
B) Code redundancy
C) Code reusability
D) None of the above

29. Which of the following blocks can be nested:


A) catch
B) finally
C) try
D) None of the above

30. Number of final blocks that are there for an exception-


handler.
A) 1
B) 2
C) 3
D) 4

31. The ___ statement takes an object of an exception class as a


parameter.
A) try
B) if
C) catch
D) finally

32. DataInputStream and DataOutputStream classes are:


A) Abstract streams
B) Mode streams
C) Markable streams
D) Filter streams

33. Unicode is used to represent data such that each character is


represented by:
A) 8 bits
B) 16 bits
C) 64 bits
D) 32 bits

34. Java provides ___ to perform I/O operations at specified


locations within a file:
A) InputStreamReader
B) RandomAccessFile
C) DataInputStream
D) DataOutputStream

35. Which of the following is not a method of DataInputStream


class:
A) void writeInt (int v )
B) int readInt ()
C) byte readByte ()
D) char readChar ()

36. Which of the following class lays the foundation for the
output class hierarchy:
A) Reader
B) InputStream
C) OutputStream
D) None of the above

37. InputStream class method is:


A) open( )
B) skip( )
C) flush( )
D) write( )

38. The streams that are read from or written to a specific place
like a disk file or memory:
A) Markable streams
B) ByteArray streams
C) Mode streams
D) Filter streams
39. Graphics class is a part of :
A) java.applet package
B) java.util package
C) java.io package
D) java.awt package

Important MCQs on High-Speed Networks

40. Which of the methods is called immediately after the init() is


called:
A) destroy( )
B) start( )
C) paint( )
D) stop( )

41. Context can be retrieved using which of the following


method:
A) getNum( )
B) getGraphics( )
C) getAppletContext( )
D) getText( )

42. Which of the following methods is defined by the AWT


Component class:
A) paint( )
B) init( )
C) stop( )
D) start( )

43. The argument temporaryFlag is set to true if the focus event


is:
A) temporary
B) gained
C) lost
D) retrieved

44. ___ object is generated when the mouse is used.


A) AdjustmentEvent
B) MouseEvent
C) PaintEvent
D) TextEvent
45. Which of the following is at the top of the event class
hierarchy:
A) java.awt.AWTEvent
B) java.awt.EventObject
C) java.util.EventObject
D) None of the above

46. In Java, events are represented by:


A) Objects
B) Anonymous classes
C) Inner classes
D) Classes

47. Which of the following class has empty methods:


A) Anonymous class
B) Adapter class
C) Nested class
D) None of the above

48. The method that returns the event ID that represents the
nature of the event:
A) getId( )
B) getNature( )
C) getName( )
D) getValue( )

49. Which of the following Swing Components hierarchically


extends the AWT applet:
A) JTree
B) JToolTip
C) JApplet
D) JPanel

50. ___ components allow the editing of multiline plain text.


A) Tree
B) Text area
C) Text field
D) Toggle

You might also like