UGC NET · Computer Science

Java Previous Year Questions

11 Java (Computer Science) questions asked in UGC NET previous year papers, each with the correct answer and explanation. Read them free on UTpaper, or attempt the full papers as timed online tests.

  • 11 questions
  • Official answer key
  • Free

Other Computer Science topics

Q1UGC NET Computer Science, June 2014 (Paper II & III, Selected Questions)
The pure object oriented programming language with extensive metadata available and modifiable at run time is
  1. ASmall talk
  2. BC++
  3. CJava
  4. DEiffel
Show answerHide answer

Correct answer: (A) Small talk

Explanation

Small talk was one of the earliest OOP's language (with other like simulate and Eiffel) and can be said to be extremely "Pure" in an OOP sense. In small talk everything is an object and objects are only communicated with via the sending of message. Hence the answer is (a).

Q2UGC NET Computer Science, December 2014 (Paper II & III, Selected Questions)
Which method is called first by an applet program?
  1. Astart ( )
  2. Brun ( )
  3. Cinit ( )
  4. Dbegin ( )
Show answerHide answer

Correct answer: (C) init ( )

Explanation

In the applet life cycle, init() is called first, followed by start(), paint(), stop() and destroy().

Q3UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
In Java , when we implement an interface method, it must be declared as :
  1. APrivate
  2. BProtected
  3. CPublic
  4. DFriend
Show answerHide answer

Correct answer: (C) Public

Explanation

Interface: It is used to provide total abstraction. That means all the methods in interface are declared with empty body and are public and all fields are public, static and final default.

Q4UGC NET Computer Science, June 2015 (Paper II & III, Selected Questions)
Which one of the following is correct?
  1. AJava applets can be written in any programming language
  2. BAn applet is not a small program
  3. CAn applet can be run on its own
  4. DApplets are embedded in another applications
Show answerHide answer

Correct answer: (D) Applets are embedded in another applications

Explanation

An applet is a small program that is intended not to be run on its own, but rather to be embedded inside-another application.

Q5UGC NET Computer Science, December 2015 (Paper II & III, Selected Questions)
JavaScript and Java similar name because ............ is/are true. (1) JavaScript's syntax is loosely based on Java's syntax (2) JavaScript is stripped down version of Java (3) Java and JavaScript are originated from Island of Java Codes :
  1. A(1) only
  2. B(1), (2) and (3)
  3. C(1) and (2)
  4. D(1) and (3)
Show answerHide answer

Correct answer: (A) (1) only

Explanation

Statement (2) and Statement (3) are not true because JavaScript is not stripped down version of Java and they are not originated from Island of Java. Although they are different languages, JavaScript's syntax is loosely based on Java.

Q6UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
The number of function points of a proposed system is calculated as 500. Suppose that the system is planned to be developed in Java and the LOC/FP ratio of Java is 50. Estimate the effort (E) required to complete the project using the effort formula of basic COCOMO given below: E = a(KLOC)ᵇ Assume that the values of a and b are 2.5 and 1.0 respectively.
  1. A25 person months
  2. B75 person months
  3. C62.5 person months
  4. D72.5 person months
Show answerHide answer

Correct answer: (C) 62.5 person months

Explanation

LOC = 500 FP × 50 LOC/FP = 25000 LOC = 25 KLOC. E = a(KLOC)ᵇ = 2.5 × (25)¹ = 62.5 person months.

Q7UGC NET Computer Science, June 2016 (Paper II & III, Selected Questions)
Given the following statements : (1) To implement Abstract data type, a programming language require a syntactic unit to encapsulate type definition. (2) To implement ADT, a programming language requires some primitive operations that are built in the language processor. (3) C++, Ada, Java 5.0, C#2005 provide support for parameterized ADT Which one of the following options is correct?
  1. A(1), (2) and (3) are false
  2. B(1) and (2) are true; (3) is false
  3. C(1) is true; (2) and (3) are false
  4. D(1), (2) and (3) are true
Show answerHide answer

Correct answer: (D) (1), (2) and (3) are true

Explanation

Language requirements for ADTs: a syntactic unit in which to encapsulate the type definition, and some primitive operations built into the language processor. Ada provides packages that simulate ADTs, C++ provides data abstraction through classes, and Java's data abstraction is similar to C++. C++, Ada, Java 5.0 and C# 2005 support parameterized ADTs. So (1), (2) and (3) are true. Hence, the answer is (d).

Q8UGC NET Computer Science, August 2016 (Paper II & III, Selected Questions)
Java uses threads to enable the entire environment to be _________ .
  1. ASymmetric
  2. BAsymmetric
  3. CSynchronous
  4. DAsynchronous
Show answerHide answer

Correct answer: (D) Asynchronous

Explanation

Java uses threads to enable the entire environment to be asynchronous. This helps reduce inefficiency by preventing the waste of CPU cycles.

Q9UGC NET Computer Science, June 2017 (Paper II & III, Selected Questions)
Which of the following statements(s) with regard to an abstract class in JAVA is/are TRUE? I. An abstract class is one that is not used to create objects. II. An abstract class is designed only to act as a base class to be inherited by other classes.
  1. AOnly I
  2. BOnly II
  3. CNeither I nor II
  4. DBoth I and II
Show answerHide answer

Correct answer: (D) Both I and II

Explanation

A class declared abstract cannot be instantiated; it must be extended and its methods implemented. It is designed only to act as a base class to be inherited by other classes. So both I and II are true.

Q10UGC NET Computer Science, June 2017 (Paper II & III, Selected Questions)
Consider the following JAVA program : public class First { public static int CBSE (int x) { if (x < 100) x = CBSE (x + 10) return (x – 1) } public static void main (String [ ] args) { system. out. print (First. CBSE (60)); } What does this program print ?
  1. A59
  2. B95
  3. C69
  4. D99
Show answerHide answer

Correct answer: (B) 95

Explanation

CBSE(60) → CBSE(70) → CBSE(80) → CBSE(90) → CBSE(100). CBSE(100) returns 99; then CBSE(90) returns 98, CBSE(80) returns 97, CBSE(70) returns 96 and CBSE(60) returns 95. So the program prints 95.

Q11UGC NET Computer Science, June 2017 (Paper II & III, Selected Questions)
What can you say about the following statements? I. XML tags are case-insensitive II. In Java Script, identifier names are case-sensitive. III. Cascading Style Sheets (CSS) cannot be used with XML. IV. All well-formed XML documents must contain a document type definition.
  1. AOnly I and II are false
  2. BOnly III and IV are false
  3. COnly I and III are false
  4. DOnly II and IV are false
Show answerHide answer

Correct answer: (D) Only II and IV are false

Explanation

I is false: XML tags are case-sensitive. II is true: JavaScript identifiers are case-sensitive. III is false: CSS can be applied to any XML document. IV is false: a well-formed XML document does not need a DTD. (The book keys option (d).)

How to use these UGC NET Computer Science questions

Every question here was asked in a real UGC NET paper; the paper and shift are shown on the card, and the number opens the question on its own page. Try each one before tapping Show answer, then attempt the full UGC NET papers as timed tests to check your speed under exam conditions.