Government Polytechnic Yavatmal
Dhamangaon Road Yavatmal
DTE CODE:-1011
Computer Engineering Department
Academic Year 2024-25
Web Site : www.gpyavatmal.ac.in E-mail:
[email protected] QUESTION BANK
Course:-Java Programming(314317) Program and Sem:- CO4K
Unit 1 : Introduction to Java
1. Why Java is not 100% Object oriented language?
2. What are the benefits of OOP?
3. What are classes? What is object?
4. State features of Java
5. Explain : abstraction, encapsulation, Polymorphism in Java
6. What is dynamic binding?
7. Explain the concept of JVM with respect to portability of Java.
8. What are Java Applets?
9. What is byte code?
10. Explain the tools available in JDK
11. WAP to accept to numbers on command prompt & print its multiplication.
12. Enlist all primitive data types in java along with their storage sizes.
13. What is type casting? Why do we need it?
14. Enlist Java operators.
15. Explain Logical operator in Java.
16. Describe various Bitwise operators with example.
17. Describe operator precedence and associativity.
18. Describe : sqrt(), min(), max(), round(), abs()
19. Differentiate between break and continuous.
20. Write a program to print Fibonacci series of given number.
21. Write a program to print array elements using for-each version of the for loop.
22. Write the output
class Demo
{
public static void main(String args[])
{
System.out.println(6<<1);
System.out.println(12>>2);
}
}
23.Define inheritance and state its types.
24.Explain the use of keyword: 1) super 2)this
25.Describe ‘final’ with respect to inheritance.
26.Explain dynamic method dispatch.
27.Differentiate between String & StringBuffer.
28.What is vector? Explain with suitable example.
29.List different methods of String class.
30.Differentiate between Array & Vector
31.Explain methods of Wrapper class.
32.WAP to convert binary to decimal using Integer Wrapper class.
33.Differentiate between method overloading & method overriding .
34.Write a program to demonstrate length() & capacity() methods of StringBuffer class.
35.What is constructor? Explain use of parameterized constructor with suitable example.
36.Fill the following table considering class member access for different access modifiers
public default protected private
same class Yes Yes
same package subclass Yes No
different package subclass Yes Yes
different package non-subclass No No
37. Find out the errors in following code and rewrite the correct code:
i) class While
public static void main(String z[])
do
system.out.println(“Java”);
while(false)
ii) Class Jump
public static void main(String args[])
for(i=0; i<10; i++)
if(i==5)
continue;
System.out.println(i);
}}}
1. Write output for
class StringEquals
{
public static void main(String args[])
{
String s1 = new String("Java");
String s2 = new String("Java")
StringBuffer sb1 = new StringBuffer("Java");
StringBuffer sb2 = new StringBuffer("Java");
System.out.println(s1.equals(s2));
System.out.println(sb1.equals(sb2));
}}
Unit 2 : Interfaces & Packages
1. What is interface? Describe syntax, feature and need of an Interface.
2. What is package? Why packages are needed?
3. Enlist built-in packages in Java along with their use.
4. Explain how user defined packages are created and accessed in Java.
5. Explain access specifiers : public, private and protected.
6. Differentiate between class and interface.
7. Explain nested interface.
8. How to implement an interface.
9. How do we add a class to package?
10. What is abstract class?
Unit3: Multithreaded Programming & Exception Handling
1. Define thread with an example.
2. Draw and explain the lifecycle of a thread.
3. What is thread priority? How to change it?
4. What is inter-thread communication?
5. What is synchronization? How do we achieve it?
6. What are different types of errors?
7. Explain: try, catch, finally, throw, throws
8. Write a program to create two threads. One thread will print even numbers while other print odd
numbers between 1 to 20
9. Write a program to input name and age of a person and throw a user defined exception if age is
negative.