[go: up one dir, main page]

0% found this document useful (0 votes)
206 views3 pages

Sem-4 Java 4 Marks IMPs

Uploaded by

saqibzuber813
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)
206 views3 pages

Sem-4 Java 4 Marks IMPs

Uploaded by

saqibzuber813
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/ 3

4 MARKS QUESTIONS

1. Explain the concept of platform independence and portability with


respect to Java language.
2. Explain the types of constructors in Java with suitable example.
3. Explain the two ways of creating threads in Java.
4. Explain different stream types (Byte streams, Character streams) and
Input vs. Output Streams.
5. Explain dynamic method dispatch in Java with suitable example.
6. Describe the use of following methods (give syntax):
(i) drawoval () (ii) getFont () (iii) drawRect () (iv) getFamily()
(v) drawLine() (vi) drawArc() (vii) drawPolygon()
7. Write a program to count number of words from a text file using stream
classes.
8. Describe instance Of and dot (.) operators in Java with suitable example.
9. Explain the four access specifiers in Java. (Visibility Controls)
10.Differentiate between method overloading and method overriding.
11.Differentiate between Java Applet and Java Application (any four points)
12.Write a program for, reading and writing character to and from the given
files using character stream classes.
13.Differentiate between String and String Buffer.
14.Define exception. State built-in exceptions.
15.Explain the following classes.
i) Byte stream class
ii) Character Stream Class
16.Differentiate between class and interfaces. (describe interface)
17.Define type casting. Explain its types with syntax and example.
18.Draw and explain life cycle of Thread.
19.Describe final variable and final method.
20.Explain any two logical operators in java with example.
21.Differentiate between array and vector.
22.List any four methods of string class and state the use of each. (of file
class)
23.Explain any four features of java.
24.Explain exception handling mechanism. w.r.t. try, catch, throw and
finally.
25.Explain single and multilevel inheritance with proper example.
26.Write a java applet to display the following output in Red colour. Refer
following figure:

27.Explain switch case and conditional operator in java with suitable


example.
28.Explain how to create a package and how to import it. (Describe the
package in java with suitable example.)
29.State the use of final keyword with respect to inheritance.
30.Write all primitive datatypes available in java with their storage sizes in
bytes.
31.Mention the steps to add applet to HTML file. Give sample code.
32.Write a Program to create user defined exception.
33.Explain the applet life cycle with neat diagram.
34.Enlist types of Byte stream class and describe input stream class and
output stream class.
35.Explain any four methods of vector class with example.

IMP
V.IMP
V.V.IMP
PROGRAMS:
1. Define a class student with int id and string name as data members and a
method void SetData ( ). Accept and display the data for five students.
2. Define a class employee with data members ‘empid’, ‘name’ and ‘salary’.
Accept data for three objects and display it.
3. Define a class circle having data members pi and radius. Initialize and
display values of data members also calculate area of circle and display it.
4. Develop a program to create a class ‘Book’ having data members
‘author’, ‘title’ and ‘price’. Derive a class ‘BookInfo’ having data
member ‘stockposition’ and method to initialize and display the
information for three objects.
5. Write a java program to find out the even numbers from 1 to 100 using
for loop
6. Write a java program to sort an 1-d array in ascending order using
bubble-sort.
7. Write a program to check whether the given number is prime or not.
8. Write a program to find reverse of a number.
9. Write a program to add 2 integer, 2 string and 2 float values in a vector.
Remove the element specified by the user and display the list.
10.Write a program to print all the Armstrong numbers from 0 to 999.

IMP
V.IMP
V.V.IMP

You might also like