0% found this document useful (0 votes)
55 views12 pages

Java QB

Uploaded by

sharmatanya12175
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)
55 views12 pages

Java QB

Uploaded by

sharmatanya12175
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/ 12

AMITY UNIVERSITY MADHYA

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 BTech CSE/BCA

Batch 2019-2023 / 2019-2022

Semester 4th Sem

Course Subject Java Programming

Course Code CSE 403

Course Credits 03

Syllabus Attached

Question bank Attached


Name of the Faculty
Dr. Ashok Kuamr Shrivastava
Member, Designation
Name of Assisting/
Re-checking Faculty Mr. Devendra K Mishra
Member
Name of the HoD Prof (Dr). Venkatadri M.
JAVA PROGRAMMING
Course Code: CSE 403 Credit Units: 03
Total Hours: 03
Course Objective :

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 :

Module I : (07 Hours)

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

Module II : (07 Hours)

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.

Module III : (06 Hours)

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.

Module IV : (07 Hours)

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

Module V : (03 Hours)

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:

Components A CT S/V/Q HA ESE

Weightage (%) 5 10 8 7 70

CT: Class Test, HA: Home Assignment, S/V/Q: Seminar/Viva/Quiz, EE: End Semester Examination; Att:
Attendance

Text & References:


Text:
 JAVA The Complete Reference by Patrick Naughton & Herbert Schild, TMH
 Introduction to JAVA Programming a primar, Balaguruswamy.
References:

 “Introduction to JAVA Programming” Daniel/Young PHI


Jeff Frentzen and Sobotka, “Java Script” , Tata McGraw Hill,1999
SUMMARY OF QUESTIONS
S.N. Module Section –A Section –B Section –C
(6 Marks) (10 Marks) (20 Marks)

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

Q 1. Explain object-oriented programming? Explain object-oriented features in Java?


Q 2. Explain Inheritance as applied in OOP.
Q 3. Discuss why Java is known as platform neutral language?
Q 4. Explain the need of an import statement?
Q 5. Explain typecasting? Why it is required in programming?
Q 6. The following code results in compile time error. Identify the error.
public static void display ()
{

int n =123456;

float f =100.12;

System.out.println(“Float value ” +f);

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 {

public static void main(String args[]) {

Test t = new Test();

System.out.println(t.x + " " + t.y);

Q 10. In what ways switch statement differs from an if statement in Java?


Q 11. Explain for loop in Java. Explain with a simple Java code.
Q 12. Explain do while loop in Java. Explain with a simple Java code.
Q 13. Explain the use of break and continue in java program. Explain with a simple Java code.
Q 14. Discuss the differences between abstract classes and interfaces in Java.
Q 15. Explain Java Virtual Machine and JIT in Java? Explain.
Q 16. Write a Short note on Bytecode in java.
Q 17. Explain Garbage collection in java.
Module II

Q 18. Write the difference between final and finalize() in Java.


Q 19. Discuss about class in OOP concept? How do we accomplish data hiding?
Q 20. Discuss about objects in OOP concept? How are they created from a class?
Q 21. How is a method defined in Java?
Q 22. Explain the concept of declaring a member of a class static?
Q 23. How do we invoke a constructor? Explain with a Java code.
Q 24. Explain visibility control of access identifier’s in Java?
Q 25. Explain branching using if else if statements?
Q 26. What are packages in Java? Explain.
Q 27. How do we design a package? Explain with a Java code.
Q 28. How do we add a class or interface to a package? Explain with a Java code.
Q 29. Explain static import concept in detail? How is it useful?
Q 30. How to create a package in java? Explain with a Java code.
Q 31. How to access the contents of package? Explain with a Java code.
Q 32. How someone can use a particular package in a file. Explain with a Java code.
Q 33. Discuss constructor in java? Explain with a Java code.
Module III
Q 34. List most common types of exceptions that might occur in Java. Explain with a Java
code.
Q 35. Write a short note on exception handling in Java?
Q 36. How do we define a try and a catch block? Explain with a Java code.
Q 37. Explain how Exception handling mechanism can be used in debugging a program.
Q 38. What is the difference between suspending and stopping a thread?
Q 39. What is synchronization? When do we use it?
Q 40. What is a thread in java? Explain with a Java code.
Q 41. Write a short note on Multithreading in java.
Q 42. How do we create a thread in Java?
Q 43. How does Java support inter thread communication?

Module IV

Q 44. Explain Abstract Windowing Toolkit (AWT) in Java?


Q 45. Find errors in the following code which draws an arc:

import java.awt.*;

import java.applet.*;

public class arc extends Applet

public void paint(Graphics g)


{

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

public void paint(Graphics g)

g.drawOval(20,20,120,120);

g.drawLine(10,100,100);

g.drawRect(10,10,100,100,10,50)

Q 47. Name different AWT layout in Java.


Q 48. Write a short note on AWT controls used in java.
Q 49. Explain swing in java? Explain with a simple Java code.
Q 50. Write the difference between AWT and Swings.
Q 51. What are the benefits of swings over AWT in java?
Module V

Q 52. Discuss Event Handling in Java?


Q 53. Explain Delegation Event model in java.
Q 54. Write a short note on Event classes in Java
Q 55. Explain Event Listener Interfaces Handling in Java.

SECTION B

Each Question Carry 10 marks

MODULE 1

Q 56. Write a program to add two complex no.


Q 57. What are command line arguments? How are they useful? Explain with a suitable java
program.
Q 58. Explain about data types in java? List basic data types used in Java. Give examples.
Q 59. What is a scope of a variable? Explain with a suitable example
Q 60. Explain type casting in java? Explain with a suitable example
Q 61. Write a program of “hello world” in java and Explain syntax of basic Java program.
Q 62. Explain decision making, branching and looping with some examples each.
Q 63. Write a program in Java to find average of n numbers, accept n from user.
Q 64. Explain method overloading in java with suitable java program.
Q 65. Write a program to check whether the string in palindrome or not.
Q 66. Write a program to add two array elements in a single array.
Q 67. What is string? Write a program to concatenate two strings. \

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

Q 84. Explain AWT controls and menus.


Q 85. What are Components and Containers in Java.
Q 86. Discuss different Layout managers with suitable example.
Q 87. How can we generate Swing Application? Demonstrate with an example program.
Q 88. Write a Java program to illustrate the use of Flow Layout Manager.
Q 89. Write a short note on the following i) JList ii) JPannel.
Q 90. Explain the usage of Menu Bar, Menu and Menu Item classes with examples.
Q 91. Explain about components in swings with suitable example.
Q 92. Write a program for Armstrong number using swings components.
MODULE V
Q 93. Write a java program using listeners for handling keyboard events.
Q 94. Discuss about different event classes.

SECTION C

Each Question Carry 20 marks

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

You might also like