Exam Details

Subject java programming
Paper
Exam / Course electronics and communication engineering
Department
Organization Vardhaman College Of Engineering
Position
Exam Date May, 2018
City, State telangana, hyderabad


Question Paper

VARDHAMAN COLLEGE OF ENGINEERING
(AUTONOMOUS)
B. Tech VI Semester Regular Examinations, May 2018
(Regulations: VCE-R15)
JAVA PROGRAMMING
(Common to Electronics and Communication Engineering
Electrical and Electronics Engineering)
Date: 21 May, 2018 FN
Time: 3 hours
Max Marks: 75
Answer ONE question from each Unit
All Questions Carry Equal Marks
Unit I
1.

Java Is a Strongly Typed Language Justify with suitable example.
5M

Write a Java class Student to meet the following specification. The class should be able to support a 5 digit student ID, student name, marks for 3 subjects. You should have methods to set and get each of the attributes, and calculate the average for the student. Write a tester program to test your class. You should create 2 or 3 students and write code to test the class.
10M
2.

Bring out the significance of the keyword final in Java.
7M

In Java, is it possible to create a member that can be used by itself, without reference to a specific instance? If yes, explain with a suitable example. If no, explain Why?
8M
Unit II
3.

With a suitable code snippet explain how dynamic method dispatch mechanism is supported by Java.
10M

How are packages created in Java? Illustrate with suitable example(s).
5M
4.

Illustrate with a suitable example how interfaces can be implemented in Java.
8M

i. Consider the following program:
class Horse
public void Print()
System.out.println("Horse");


class RaceHorse extends Horse
public void Print()
System.out.println("RaceHorse");


class Test
public static void DoPrint( Horse h
h.Print();

public static void main(String[] args)
Horse x new
Horse y new RaceHorse();
Racehorse z new RaceHorse();
DoPrint(x);
DoPrint(y);
DoPrint(z);


What is printed when this program is executed?
Cont…2
7M
2
ii. Consider the following program:
interface Employee
public void RaiseSalary();

interface Musician
public void

class Test implements Employee, Musician
public void RaiseSalary()
System.out.println("raising");

public void Play()
System.out.println("playing");

public static void main(String[] args)
Test x new
x.RaiseSalary();
x.Play();


State which of the following statements are holds good or does not hold good with respect to above code snippet:
I. An attempt to compile this program fails because class Test tries to implement two interfaces at once.
II. An attempt to compile this program fails because class Test only implements interfaces, it does not extend any class
III. An attempt to compile this program fails because the definitions of the two interfaces and the class are all in the same file.
IV. It is optional for class Test to implement the methods RaiseSalary and Play
Unit III
5.

How are uncaught exceptions handled in Java? Illustrate with a suitable example.
8M

Describe the use of synchronized keyword.
7M
6.

Describe the approaches for creating threads in Java.
8M

Consider the following function:
static void f(int String
int j 1
int len A.length
char
try
c S.charAt(0);
if 10) j
catch (ArrayIndexOutOfBoundsException ex)
System.out.println("array error");
throw new InternalError();
catch (ArithmeticException ex)
System.out.println("arithmetic error");
catch (NullPointerException ex)
System.out.println("null
finally
System.out.println("in finally clause");

System.out.println("after try block");

Cont…3
7M
3
i. Part
Assume that variable X is an array of int that has been initialized to be of length 3. For each of the following calls to function say what (if anything) is printed by and what, if any, uncaught exceptions are thrown by f.
I.
II.
III.
IV. null);
ii. Part
Why doesn't f need to have a throws clause that lists the uncaught exceptions that it might throw?
Unit IV
7.

Explain the delegation event model and the role of source and listeners with examples.
8M

What is an adapter class? Illustrate it with a suitable example.
7M
8.

Demonstrate how Keyboard events are handled with an example.
7M

Write a temperature conversion program that converts the temperature given in Fahrenheit to Celsius. The Fahrenheit temperature should be entered from the keyboard (via JTexfield). A JLabel should be used to display the converted temperature.
8M
Unit V
9.

Demonstrate with a Java program to reading and writing files.
8M

Outline the syntax for a fuller form of the APPLET tag.
7M
10.

Describe how an applet works. State the purpose of the following methods:
stop() and destroy(). In which order these methods are executed?
7M

ArrayList class supports dynamic arrays that can grow as needed in java. Illustrate with example.


Other Question Papers

Subjects

  • air pollution and control
  • automobile engineering
  • cmos vlsi design
  • data communications
  • design of machine members-ii
  • design of steel structures
  • digital electronics
  • digital system design
  • environmental engineering
  • geo technical engineering-ii
  • ground water hydrology
  • heat transfer
  • intellectual property rights
  • java programming
  • low power vlsi design
  • metrology and surface engineering
  • microprocessors and microcontrollers
  • neural networks and fuzzy logics
  • power electronics
  • power system dynamics and stability
  • power system operation and control
  • real time operating systems
  • satellite communications
  • special electrical machines
  • unconventional manufacturing processes