Java QB
Java QB
PRADESH,GWALIOR
QUESTION BANK
OF
Java Programming
CSE-403
PREPARED BY
Dr. Ashok Kumar Shrivastava
Associate Professor
Department of Computer Science & Engineering
Amity School of Engineering & Technology
AMITY UNIVERSITY MADHYA PRADESH, GWALIOR
Jan 2022
AMITY SCHOOL OF ENGINEERING & TECHNOLOGY (ASET)
META DATA : QUESTION PAPER
Course Credits 03
Syllabus Attached
The objective is to impart programming skills used in this object oriented language java. The course explores all the
basic concepts of core java programming. The students are expected to learn it enough so that they can develop the
web solutions like creating applets etc.
Course Contents :
Object Oriented Programming: Concept and features of object-oriented programming, create classes and objects and
add methods to a class, Real World Comparison. Evolution of JAVA: History of Java, Requirements and Environment
(JDK), Comparison with other languages, Basic Features & Java Architecture-Java Virtual Machine (JVM), Installing
Java Development Kit, Program Structure- Data types, Variables and Operators. Arrays
Classes and Objects in Java: Understanding Constructors, Dealing with Garbage Collection. Working with Inheritance
in Java: Understanding Abstract Classes and Interfaces. Packages: Introduction to packages, How to implement a
package, CLASSPATH Setting for Packages, Types and understanding packages.
Multithreaded Programming: Basic concepts and needs of multi-threading, Life Cycle of a Thread, How to create a
thread, Handling Thread Priorities, Enforcing Thread Synchronization, Maintaining Inter-thread Communication.
Exception Handling: The Idea behind Exception, Exceptions & Errors, Types of Exception, Control Flow in
Exceptions, Use of try, catch, finally, throw, throws in Exception Handling.
GUI Programming -Introduction to AWT, Window Fundamentals, Working with Graphics, Using AWT Controls and
Menus, Understanding Layout Managers. JFC and Swing - A Higher Level of User Interaction, Features of the Java
Foundation Classes, Overview of Swing, Components and Containers, Swing Packages, Exploring Swing
components, Generating Swing Application
Event Handling -The Delegation Event Model, Event Classes, Event Listener Interfaces Handling Various Events.
Course Outcomes:
The student will learn:
Students can perform object oriented programming solution and develop solutions to problems demonstrating
usage of control structure, modularity, classes, I/O and the scope of the class members
Students can demonstrate adeptness of object oriented programming in developing solution to problems
demonstrating usage of data abstraction, encapsulation and inheritance
Students can demonstrate ability to implement one or more patterns involving dynamic binding and
utilization of polymorphism in the solution of problems
Students can demonstrate ability to implement multithreading in the programming.
To learn syntax and features of exception handling
Students can demonstrate the ability to implement solution to various I/O manipulation operations and the
ability to create two-dimensional graphic components using Swings.
To demonstrate the ability to handle Events in the Programming
Examination Scheme:
Weightage (%) 5 10 8 7 70
CT: Class Test, HA: Home Assignment, S/V/Q: Seminar/Viva/Quiz, EE: End Semester Examination; Att:
Attendance
1 I 17 12 05
2 II 16 08 06
3 III 10 08 03
4 IV 08 13 04
5 V 04 04 02
TOTAL 55 45 20
CSE 403 Java Programming
SECTION A
(Each carry 6 marks )
Module 1
int n =123456;
float f =100.12;
Q 7. Explain Looping in Java. Also debug the code for displaying numbers 1 to 10 using do-
while loop.
Class doWhile
{
public static void main(String[] args)
{
int num =1;
do
{
System.out.println(num);
}while(num>=10)
}
}
Q 8. Discuss the concept of scope of a variable?
Q 9. Predict the output of the following program?
class Test {
protected int x, y;
class Main {
Module IV
import java.awt.*;
import java.applet.*;
g.drawArc(60,178,80,40,160,180);
g.fillArc(60,178,80,40,160,180);
g.setFont(“Arial”);
g.drawString(“Arc Demo”,50,50);
Q 46. An oval line and rectangle are being created using the code. Correct the code.
import java.awt.*;
import java.applet.*
class roundrect extends Applet
g.drawOval(20,20,120,120);
g.drawLine(10,100,100);
g.drawRect(10,10,100,100,10,50)
SECTION B
MODULE 1
MODULE II
Q 68. Discuss about JVM, JIT, JDK, Byte-codes in Java? Explain in detail.
Q 69. Explain Interfaces in Java? Explain using Java program.
Q 70. In Java explain packages and how to implement it. What are types of packages?
Q 71. Discuss the various levels of access protection available for packages and their
implications.
Q 72. What is multiple inheritances? Is multiple inheritances allowed in java. How to achieve
Multiple inheritance?
Q 73. Describe the various forms of implementing interface with suitable example.
Q 74. Give an example where interface can be used to support multiple inheritances. Develop a
standalone java program for the example.
Q 75. What are Java API packages? Write frequently used java API packages and their
contents.
Module III
Q 76. What is the difference between exception and error? How to catch and handle different
types of exceptions?
Q 77. Explain Multi Threaded Programming in Java? With suitable example.
Q 78. Write a Java program that prints numbers from 1 to 10 line by line after every 5 seconds
Q 79. What is thread synchronization? Discuss with an example.
Q 80. Explain about java.lang.thread package. Discuss with examples.
Q 81. How to set priorities for threads? Discuss with examples.
Q 82. What Java interface should be implemented by all threads?
Q 83. What is the difference between multiprocessing and multithreading? What is to be done
to implement these in a program?
MODULE IV
SECTION C
MODULE I
Q 95. Write in detail on branching and looping and branching and decision making each with
suitable example.
Q 96. Explain Primitive type conversion and casting with examples. Also explain in detail on
object oriented programming features
Q 97. How arrays are declared and initialized? Explain with examples.
Q 98. Explain the drawbacks of procedural languages? Explain the need of object oriented
programming with suitable program. Write a program that will compute the Fibonacci
series.
Q 99. Discuss static class and static method? Can we make an instance of an abstract class?
Justify your answer with an example?
MODULE II
Q 100. a) Explain briefly the following object oriented concepts. i) Abstraction ii) Polymorphism
b) "Java is called Machine Independent language" - Justify this statement with proper
explanation.
Q 101. What is inheritance? Explain in detail inheritance in java with examples. Explain multiple
inheritance implementation and multilevel inheritance with help of JAVA code only.
Q 102. Differentiate between class and object. Write a java program factorial of a number using
command line arguments.
Q 103. How Packages differ from Interfaces? Explain it with a suitable example program to
calculate student marks statement.
Q 104. a) With suitable code segments illustrate various uses of ‘final’ keyword.
b) How to handle multiple catch blocks for a nested try block? Explain with an example.
Q 105. Describe the various forms of implementing interfaces. Give examples of java code for
each case.
MODULE III
Q 106. Explain how to create a user defined exception in Java. Write a Java program for creating
a user defined exception “Invalid Age Exception” in such a way that whenever a user enters
an age less than or equal to zero it will throw the user defined exception. Explain in what
conditions Finally block will not get executed in Java.Differentiate between multithreading
and multitasking. Explain types of Error in detail.
Q 107. Explain the synchronization of multiple threads in Java with an example.
Q 108. Explain how to throw, catch and handle Exceptions. Explain Thread Priorities in detail.
MODULE IV
Q 109. Write a swing program for login page by considering username and password. If both are
correct then only it has to go to the next page. Otherwise it has to display the error invalid
user and password.
Q 110. Explain in detail Graphical UI Programming. Differentiate between AWT and Swing.
Q 111. Explain in detail SWING along with a suitable example. Explain the features of Swings
in java.
Q 112. Write an example java program that displays four push buttons and a text field. Each
button displays an icon that represents the flag of a country. When a button is pressed, the
name of that country is displayed in the text field.
MODULE V
Q 113. Explain Event Handling? Develop a java code that keeps the count of right clicks of
mouse.
Q 114. Discuss about different event classes. Write a java program using listeners for handling
keyboard events