0% found this document useful (0 votes)
58 views7 pages

Paper-CC03 JAVA CA Sem-II

Java notes

Uploaded by

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

Paper-CC03 JAVA CA Sem-II

Java notes

Uploaded by

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

QUESTION BANK

Paper-CC03(JAVA)
Semester-II
Subject: Computer Application

1. Which of the following is not a Java features?


a. Dynamic
b. Architecture Neutral
c. Use of pointers
d. Object-oriented
2. What should be the execution order, if a class has a method, static block, instance block,
and constructor, as shown below?
public class First_C {
public void myMethod()
{
System.out.println("Method");
}

{
System.out.println(" Instance Block");
}

public void First_C()


{
System.out.println("Constructor ");
}
static {
System.out.println("static block");
}
public static void main(String[] args) {
First_C c = new First_C();
c.First_C();
c.myMethod();
}
}
a. Instance block, method, static block, and constructor
b. Method, constructor, instance block, and static block
c. Static block, method, instance block, and constructor
d. Static block, instance block, constructor, and method
3. The \u0021 article referred to as a
a. Unicode escape sequence
b. Octal escape
c. Hexadecimal
d. Line feed
4. _____ is used to find and fix bugs in the Java programs.
a. JVM
b. JRE
c. JDK
d. JDB
5. Which of the following is a valid long literal?
a. ABH8097
b. L990023
c. 904423
d. 0xnf029L
6. Which of the following for loop declaration is not valid?
a. for ( int i = 99; i >= 0; i / 9 )
b. for ( int i = 7; i <= 77; i += 7 )
c. for ( int i = 20; i >= 2; - -i )
d. for ( int i = 2; i <= 20; i = 2* i )
7. Which of the given methods are of Object class?
a. notify(), wait( long msecs ), and synchronized()
b. wait( long msecs ), interrupt(), and notifyAll()
c. notify(), notifyAll(), and wait()
d. sleep( long msecs ), wait(), and notify()
8. How many threads can be executed at a time?
a. Only one thread
b. Multiple threads
c. Only main (main() method) thread
d. Two threads
9. In object-oriented programming, new classes can be defined by extending existing
classes. This is an example of:
a. Encapsulation b. Interface
c. Composition d. Inheritance (e) Aggregation.
10. The wrapping up of data and functions into a single unit is called
a. Encapsulation b. Abstraction
c. Data Hiding d. Polymorphism e. Message passing.
11. The concept of multiple inheritances is implemented in Java by
I. Extending two or more classes.
II. Extending one class and implementing one or more interfaces.
III. Implementing two or more interfaces.
a. Only (II) b. (I) and (II) c. (II) and (III)
d. Only (I) e. Only (III).
12. A package is a collection of
a. Classes b. Interfaces c. Editing tools
d. Classes and interfaces e. Editing tools and interfaces.
13. Which of the following statements are true regarding the finalize( ) method?
(a) The finalize ( ) method must be declared with protected accessibility
(b) The compiler will fail to compile the code that explicitly tries to call the finalize( )
method
(c) The body of the finalize ( ) method can only access other objects that are eligible for
garbage collection
(d) The finalize ( ) method can be overloaded
(e) The finalize() method cant be overloaded.
14. An overloaded method consists of,
(a) The same method name with different types of parameters
(b) The same method name with different number of parameters
(c) The same method name and same number and type of parameters with different
return type
(d) Both (a) and (b) above
(e) (a), (b) and (c) above.
15. In Java, a try block should immediately be followed by one or more ……………….. blocks.
(a) Throw (b) Run (c) Exit (d) Catch (e) Error.
16. In object-oriented programming, the process by which one object acquires the properties of
another object is called
(a) Encapsulation (b) Polymorphism (c) Overloading
(d) Inheritance (e) Overriding.
17. Which of these functions is called to display the output of an applet?
a) display()
b) paint()
c) displayApplet()
d) PrintApplet()
18. Which of these methods can be used to output a string in an applet?
a) display()
b) print()
c) drawString()
d) transient()
19. Which of these methods is a part of Abstract Window Toolkit (AWT) ?
a) display()
b) paint()
c) drawString()
d) transient()
20. What does AWT stands for?
a. All Window Tools
b. All Writing Tools
c. Abstract Window Toolkit
d. Abstract Writing Toolkit
21.Which three are valid declarations of a char?
a. char c1 = 064770;
b. char c2 = 'face';
c. char c4 = \u0022;
d. char c5 = '\iface';
22. Which of these keywords is used to define interfaces in Java?
a. interface
b. Interface
c. intf
d. Intf
23. Which of these access specifiers can be used for an interface?
a. Public
b. Protected
c. private
d. All of the mentioned
24. The old name of Java was ?
a. J language
b. oak
c. oct
d. None of above
25. What is used by a thread to enter the waiting state?
a. wait()
b. 2.sleep()
c. 3.suspend()
d. 4. All of the above.
26. If method have same name as class name and method don’t have any return type then it is
known as ?
a. statement
b. Object
c. Variable
d. Constructor
27. Thread class is available in ?
a. java.io package
b. java.lang package
c. java.awt package
d. java.util package
28. Which command is used to compile a java program ?
a. javac
b. java
c. javad
d. javadoc
29. Java is a ........... language
a. weakly typed
b. strongly typed
c. moderate typed
d. None of these
30. Interfaces helps in which type of inheritance ?
a. Multiple inheritance
b. Multilevel inheritance
c. Hierarchical inheritance
d. None of above
Short type question
21. What is Java?
22. What are the differences between C++ and Java?
23. What do you understand by Java virtual machine?
24. How many types of memory areas are allocated by JVM?
25. What is JIT compiler?
26. What are the main differences between the Java platform and other platforms?
27. What is classloader?
28. What are the various access specifiers in Java?
29. What is the purpose of static methods and variables?
30. What are the advantages of Packages in Java?
31. What is object-oriented paradigm?
32. What is an object?
33. What is the constructor?
34. How many types of constructors are used in Java?
35. What is the purpose of a default constructor?
36. What do you understand by copy constructor in Java?
37. What are the differences between the constructors and methods?
38. What is this keyword in java?
39. What is the Inheritance?
40. Why is Inheritance used in Java?
41. Why is multiple inheritance not supported in java?
42. Which class is the superclass for all the classes?
43. What is super in java?
44. What are the main uses of the super keyword?
45. What is method overloading?
46. What is method overriding:
47. What is the final variable?
48. What is the final method?
49. What is the final class?
50. What is the difference between the final method and abstract method?
51. What is the difference between static binding and dynamic binding?
52. What is the interface?
53. Can you declare an interface method static?
54. What are the differences between abstract class and interface?
55. What is Exception Handling?
56. What is the difference between Checked Exception and Unchecked Exception?
57. What is the difference between throw and throws?
58. What is the meaning of immutable regarding String?
59. What are the differences between String and StringBuffer?
60. What is Garbage Collection?
61. What is the purpose of the finalize() method?
62. What are wrapper classes?
63. What are autoboxing and unboxing? When does it occur?
64. What is the purpose of the System class?
65. What is a singleton class?
66. Write a Java program that prints all the values given at command-line.
67. What is an applet?
68. What is Synchronization?
69. How do you make a thread stop in Java?
70. Which classes can an applet extend?
Long type question
71. List the features of Java Programming language.
72. How do you make a thread in Java?
73. What does the yield method of the Thread class do?
74. Explain the thread life cycle in Java.
75. How many types of exception can occur in a Java program?
76. Explain the hierarchy of Java Exception classes?
77. Difference between method Overloading and Overriding.
78. Explain the concept of boxing, unboxing, autoboxing, and auto unboxing.
79. Explain the life cycle of an Applet.
80. Who is responsible to manage the life cycle of an applet?
81. Draw 3D Rectangle & Square in Applet.
82. Draw Oval & Circle in Applet Window
83. What is an array. Write a program in java to store 10 elements in one dimensional array and
find largest among them.
84, What is interface? How to implement interface in java?
85. What is package. How to build it.
86. Write a program in java to find reverse of a number given by user?
87. . What is inheritance. Give with an example.
88. Write a program in JAVA to enter a number from user and check whether a number is
positive or negative.
89. Write a program in JAVA to enter three coefficients from a user and find roots by quadratic
equation.
90. Write a program in JAVA to print 1 to 100.
91. Write a program in JAVA to print even numbers between 1 to 100.
92. Write a program in JAVA to print sum of even numbers between 1 to 100.
93. Write a program in JAVA to enter a number from the user and display its reverse.
94. Write a program in JAVA to enter a number from user and check whether a number is prime
or not.
95. Write a program in JAVA display the multiplication table of any no.
96. Write a program in JAVA to enter a string from user and copy it to another string.
99. Write a program in JAVA to enter a string from user and find its length.
100. Write a function in JAVA to calculate factorial of a number.
101. Write a program in JAVA to store ten numbers from user in one-dimensional array and find
its sum and average.
102. Write a program in JAVA to store ten numbers from user in one-dimensional array and
find largest of them.
103. Write a program in JAVA to store nine [3 x 3] elements in two-dimensional array and
display them.
104. Write a program in JAVA to show single inheritance.
105. Write a program in JAVA to show multiple Inheritance.
106. Write a program in JAVA to show multithreading in JAVA.
107. Write a program in JAVA to show interface.
108. Write a program in JAVA to create a package named try with function factorial and square.

Archana Kumari

****************************

You might also like