You are on page 1of 9

Shivaji University, Kolhapur

Question Bank For Mar 2022 (Summer) Examination


Subject Code: 66070 Subject Name: Introduction to Java Programming

Q. 1 Select correct alternative and rewrite the statement.

1. Which class cannot be subclassed (or extended) in java?

a) abstract class
b) parent class
c) Final class
d) None of above

2. What will be the output of the program?

a) Within Derived class show()


b) Within Base class show()
c) Runtime Error
d) Compilation Error

3. Thread class is available in


a) java.io package
b) java.lang package
c) java.awt package
d) java.util package
4. After the compilation of the java source code, which file is created by the JVM
a) .class
b) .java
c) .cdr
d) .doc
5. Methods that have same name, but different Parameter list and different definition known
as
a) Overriding
b) Constructor
c) Overloading
d) none of these
6. JIT meaning
a) java in time
b) just in time
c) join in time
d) none of above
7. What is size of char data type?
a) 8 bits
b) 32 bits
c) 64 bits
d) 16 bits
8. The signature of a method contains a list of ...........
a) arguments
b) none of the mentioned
c) parameters
d) both arguments and parameters
9. A class can use the .......... keyword to explicitly refer to a field or method that is inherited
from a parent.
a) Super
b) super
c) super()
d) Super()

10. What words are required when creating an interface?


a) public, void
b) abstract, final
c) abstract, public
d) none of these are required
11. If you put a reference to the super class at the end of the constructor...
a) the program will display an error
b) the program will only create an instance of the super class
c) the program will only create an instance of a sub class
d) order does not matter
12. Why would you declare a class abstract?
a) You do not want the programmer to instantiate that class.
b) It helps organize your classes.
c) You want the parent class to override the child class.
d) You don't want to declare an abstract class, only methods.
13. Why would you declare an abstract method?
a) To have a default method with behavior in the parent class
b) To force the programmer to overload the method.
c) To force the programmer to override the method.
d) You don't want to declare abstract methods, only classes.
14. If your program accesses an array through an out-of-bounds index, what type of error is
it?
a) Compiler error
b) No error, just doesn't computer properly
c) No error, just hangs
d) Run-time error
15. A method that changes the state of an object is called a _______ method.
a) accessor
b) mutator
c) immutable
d) final
16. A method that accesses an object but does not change it is called a ________ method.
a) accessor
b) mutator
c) immutable
d) final
17.___ methods must be implemented when using an interface.
a) Abstract
b) Private
c) Public
d) Static
18. If you don't include a package statement in your class source file, its classes will be
placed:
a) in java.lang
b) in java.util
c) in the default package, which has no name
d) in java.awt
19. Suspend thread can be revived by using
a) start() method
b) Suspend() method
c) resume() method
d) yield() method
20. Java intermediate code is known as
a) First code
b) Mid code
c) Byte code
d) None of above
21. Which keyword is used while using interface
a) extend
b) implements
c) throw
d) throws
22. An error that occurs as a result of incorrect programmer logic.
a) Syntax Error
b) Logic Error
c) Run-Time Error
d) Catch
23. An exception that is optional to be handled.
a) Unchecked Exceptions
b) Checked Exceptions
c) Throw
d) Catch
24. Possible way of creating an exception in Java?
a) throw Exception("Exception text");
b) public void <methodName>() throws Exception
c) new <ExceptionClassName>("<Exception text>");
d) <ExceptionClassName> implements <ExceptionInterfaceName>
25. System.out.println() this is a/an...................... method.
a) main
b) overriden
c) simple
d) overloaded
26.Which of the following personality is called as father of Java Programming language ------
a) James Gosling
b) Larry Page
c) Bjarne Stroustrup
d) none of these
27. JRE Stands for ____________.
a) Java Reply Engine
b) Java Running Engine
c) Java Runtime Engine
d) Java Runtime Environment
28. An array index must be at least ________ and less than the size of the array.
a) zero
b) one
c) can be any number
d) none of these
29. When finally block gets executed?
a) Always when try block get executed, no matter exception occured or not.
b) Always when a method get executed, no matter exception occured or not.
c) Always when a try block get executed, if exception do not occur.
d) Only when exception occurs in try block code.
30. Individual elements in an array are accessed by integer index i, using the notation
_________
a) array{i}
b) array[i]
c) array(i)
d) Array[i]
31.double[] values = new double[10] defines an array of 10 elements with an index range
from
a) 1-10
b) whatever numbers you set
c) 0-9
d) Unknown
32. When does method overloading is determined?
a) At run time
b) At compile time
c) At coding time
d) At execution time
33. Which of these values can a boolean variable contain?
a) True & False
b) 0 & 1
c) Any integer value
d) true
34. Which statement is true about java?
a) Platform independent programming language
b) Platform dependent programming language
c) Code dependent programming language
d) Sequence dependent programming language

35. Which of these packages contains abstract keyword?


a) java.lang
b) java.util
c) java.io
d) java.system

36. A keyword in Java that signals the following block of code handles a specified exception.
a) Error
b) Throw
c) Try/Catch Block
d) Catch

37. Which of these functions is called to display the output of an applet?

a) display()
b) paint()
c) displayApplet()
d) PrintApplet()
38. What is true about a break?
a) Break stops the execution of entire program
b) Break halts the execution and forces the control out of the loop
c) Break forces the control out of the loop and starts the execution of next iteration
d) Break halts the execution of the loop for certain time frame

39. What will be the output of the program?

a) false
b) true
c) Runtime Error
d) Compilation Error
40. Possible way of creating an exception in Java?

a) throw Exception("Exception text");


b) public void <methodName>() throws Exception
c) new <ExceptionClassName>("<Exception text>");
d) <ExceptionClassName> implements <ExceptionInterfaceName>

41. How can we explicitly throw an exception in Java?

a) throw new <ExceptionClassName>("Exception text");


b) public void <methodName>() throws Exception
c) new <ExceptionClassName>("<Exception text>");
d) <ExceptionClassName> throws <ExceptionInterfaceName>

42. What will be the output of the following Java code?

a) 18
b) 24
c) 19
d) 33
43. What will be the output of the following Java code?

a) i i i i i
b) 0 1 2 3 4
c) i j k l m
d) i i i i i i i i i i
44. Which component is responsible to run java program?

a) JVM
b) JDK
c) JIT
d) JRE

45. What is true about a break?

a) Break stops the execution of entire program


b) Break halts the execution and forces the control out of the loop
c) Break forces the control out of the loop and starts the execution of next iteration
d) Break halts the execution of the loop for certain time frame

Q2. Attempt any TWO of the following.

1. Elaborate the design of a class in a java program with an example.


2. Describe the features of Java.
3. Explain the process of execution of java program.
4. What are different data types supported by Java? Explain their range and size.
5. Why the main method in Java program is static? When should we declare a method
final? Explain with an example.
6. Briefly explain parameterized constructor with the help of an example.
7. Explain the difference between Method Overloading and Method Overriding.
8. What is a Package in Java? What are steps for creating our own Package?
9. Create an interface with a method signature and implement it in various classes.
10. What is polymorphism? Explain the advantages of using virtual methods.
11. Explain the concept of Multithreading with an example.
12. Describe the Life Cycle of a Thread.
13. What do you mean by an access specifier? With the help of an example, describe the
visibility of various access specifier supported by Java.
14. With the help of an example describe nesting of try blocks to catch three different
types of exceptions.
15. Explain Exception handling with an example

Q3. Attempt any FOUR of the following.

1. Write a short note on Final keywords


2. Write a short note on Super keywords
3. Explain Wrapper class
4. Elaborate the term Array of objects
5. What are the different methods of array class
6. Write a short note on Vector class
7. Explain Hash table with it's methods
8. Describe List iterator with an example
9. Write a short note on Stack
10. What are the Methods of thread class
11. Briefly explain Synchronization and thread priority
12. Elaborate checked exceptions.
13. What is the use of Finally clause
14. What is the use of this pointer
15. Write a short note on JAR
16. Write a short note on Inheritance
17. What is Interface? How it can be defined?
18. Write a short note on Abstract Class
19. What is the use of Constructors?
20. Briefly explain about Method signature
21. What are the different types of Polymorphism?
22. Explain Handle and Declare Rule
23. Write a short note on Hashtable Class
24. Briefly explain Java Collection Framework
25. Write a short note on import keyword.
26. What is Encapsulation?
27. Explain For loop with an example.
28. Write a short note on Break Keyword.
29. Explain While and Do-While loop with an example.
30. Write a short note on wait() and notify() methods.

You might also like