Diploma In CS

PYQ – JAVA PROGRAMMING (2418401) | SEMESTER 4TH (2ND YEAR) | Year 2021

Share:WhatsAppTelegramTwitter
JAVA PROGRAMMING (2418401) – Years

JAVA Programming 2021 (OLD) PYQ.

JAVA2021PYQ


Group A

Choose the most suitable answer from the following options: -   (1*20=20)


(i) Which statement is true regarding an object: 

(a) An object is of a class

(b) An object is an instance of a class

(c) An object is a variable

(d) An object is not an instance of class


(ii) Which one of the following is not an object-oriented language? 

(a) Simula

(b) Java

(c) C++

(d) C


(iii) Which one of the following terms must relate to polymorphism?

(a) Static allocation

(b) Static typing

(c) Dynamic binding

(d) Dynamic allocation


(iv) The concept of derived class is involved in :-

(a) Inheritance                          

(b) Encapsulation

(c) Data hiding

(d) Abstract data types


(v) Inheritance is a way to

(a) Organize data

(b) Pass arguments to object of classes

(c) Add features to existing classes without rewriting them.

(d) Improve data-hiding and encapsulation


(vi) Which of the following is true about class?

(a) Class possesses data and methods

(b) Classes are physical in nature

(c) Collection of similar type of objects is a class

(d) Both (a) and (c)


(vii) What was the name of first version of Java?

(a) Oak

(b) Mustang

(c) Tiger

(d) Playground


(viii) What is the name of the tool that is used for compiling a java program?

(a) Javap

(b) Java

(c) Javah

(d) Javac


(ix) What is the extension of the source files in Java?

(a) .Jav

(b) .Java

(c) .Bytecode

(d) .Class

 
(x) Which of these assignments are valid?

(a) Short S=48;

(b) Double d=4.3;

(c) int m=’1’;

(d) All of the above

 
(xi) What is the output when the following program is compiled and run?

Class test {

Public static void main (String args [] )

{int i,j,k,l=0;

K = l++;

J = ++k;

I = j++;

System.out.println (i);

} }

(a) 0 

(b) 1

(c) 2

(d) 3


(xii) Which operator is used to perform bitwise inversion in Java?  

(a) ~

(b) !

(c) &

(d) 1


(xiii) Which of the following statements are true?

(a) Constructors cannot be inherited

(b) There is an <init> method created implicitly for each constructor 

(c) Default constructors will not be provided if a class declares

(d) All the above


(xiv)Which is the keyword used for deriving classes?

(a) Implements

(b) Extends

(c) Throws

(d) Inherits

 
(xv) Given a one- dimensional array arr, what is the correct way of getting its number of elements?

(a) arr. length

(b) arr. Length-1

(c) arr. Size

(d) arr. Size-1


(xvi) Which of the following statements are legal declarations and definitions of a method?

(a) Void method () { }

(b) Void method (void) { };

(c) Method () { }

(d) Method (void) { };


(xvii) Which keyword is used for accessing the features of a package?

(a) Export  

(b) Import

(c) Package  

(d) Extends


(xviii) Which of the following is not a method of an applet’s life cycle?

(a) Init  

(b) Start

(c) Sleep

(d) Stop


(xix) Which tool is used to compile an applet?

(a) Java  

(b) Javac

(c) Appletviewer  

(d) Appletc


(xx) Which class provides the functionality to draw different shapes?

(a) Line  

(b) Graphics

(c) Shapes  

(d) Graph

 

Group:-"B"

Answer all Five Questions: -                         (5*4=20) 

 

2. State the different ways of executing an applet. 

OR

 What are classes and objects?

 

3. What are the difference between for, while and do while loops? 

OR

 What are the rules for naming an identifier in java?

 

4. Explain the structure of a java program. 

OR

 Write a program to print “Hello” message in java.

 

5. Write short notes on polymorphism. 

OR

 Differentiate between procedural language and oops languages.

 

6. Explain the importance of JVM in JRE. 

OR

 How can a message from a HTML page be passed to an applet?

 

Group:- "C"

Answer all Five Questions: -                         (5*6=30) 

 

7. Describe the complete life cycle of an applet. 

OR

 Explain the use of overriding the following methods for an applet: -

(a)    Init

(b)   Start

(c)    Stop

 

8. Explain the difference between file input and buffer input stream. Show an example in support of your answer.

OR

 What is a thread? How do threads behave in java?

 

9. What are exceptions? How are they handled in java?  

OR

 Write a program to count the number of words and characters in a string.

 

10. What is an interface? How is it different from an abstract class?  

OR

 Explain super keyword with all its usages. Support explanation with a program.

 

11. What is inheritance? How is it different from aggregation?  

OR

 What is method overloading? Explain with the help of a program.

 

 

*****

Thank you for visiting us, Hope you like our content and its really helpful for you.

Do follow us for regular updates and if you want any specific help feel free to ask on below.

 

Web Site: https://diplomaincs.in/

 

Contact Us: https://diplomaincs.in/contact-us

 

Follow us on below social handle:-


LinkedIn:
https://www.linkedin.com/in/computer-scinece-and-engineering-diploma-b5917b3a1/

What’s App:
https://whatsapp.com/channel/0029VaGwTZU1t90j9c1bKl0g


Facebook:
https://www.facebook.com/Diploma.1234

 

 

Q1

PYQ Video References

No references available right now.

Comments & Reviews

Loading comments...