2019 051529

B.Tech 5th Semester Exam., 2019

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

  1. Choose the correct option (any seven) :

Q1.a

Which of the following is a valid declaration of an object of class Box?

a)

Box obj = new Box();

b)

Box obj = new Box;

c)

obj = new Box();

d)

new Box obj;

Q1.b

Which operator is used to invert all the digits in a binary representation of a number?

a)

<<<

b)
c)

~

d)

^

Q1.c

Which of these cannot be declared static?

a)

Class

b)

Object

c)

Variable

d)

Method

Q1.d

Which polymorphism concept is applied to inheritance relationship in Java programming?

a)

Method overloading

b)

Constructor overloading

c)

Method overriding

d)

None of the above

Q1.e

Which of the following operators can operate on a Boolean variable?

  1. &&
  2. --
  3. ?:
  4. +=
a)

3 and 2

b)

1 and 4

c)

1, 2 and 4

d)

1, 2 and 3

Q1.f

Which of these is a process of converting a simple data type into a class?

a)

Type wrapping

b)

Type conversion

c)

Type casting

d)

None of the above

Q1.g

Which of these methods of thread class is used to suspend a thread for a period of time?

a)

sleep()

b)

terminate()

c)

suspend()

d)

stop()

Q1.h

Which of these functions is called to display the output of an applet?

a)

display()

b)

paint()

c)

displayApplet()

d)

printApplet()

Q1.i

Which of the following is the advantage of using PreparedStatement in Java?

a)

Slow performance

b)

Encourages SQL injection

c)

Prevents SQL injection

d)

More memory usage

Q1.j

Which of the following is a method of JDBC batch process?

a)

setBatch()

b)

deleteBatch()

c)

removeBatch()

d)

addBatch()

Q.2

Q2.a

What are the drawbacks of procedural languages? Explain the need of object-oriented programming with suitable program.

Q2.b

What are the wrapper classes? Write a Java program to find the GCD of two numbers.

Q.3

Q3.a

Write an iterative Java program to reverse digits of a number.

Q3.b

Write a Java program to check whether a given number is a happy number or unhappy number. Happy number : Starting with any positive integer, replace the number by the sum of the squares of its digits and repeat the process until the number equals 1, or it loops endlessly in a cycle which does not include 1. Unhappy number : A number that is not happy. The first few unhappy numbers are 2, 3, 4, 5, 6, 8, 9, 11, 12, 14, 15, 16, 17, 18, 20.

Q.4

Q4.a

With suitable code segments, illustrate various uses of 'super' keyword.

Q4.b

Write a Java program to demonstrate working of Arrays.equals() for user-defined objects.

Q.5

Q5.a

What is constructor? Write a Java program to find the area of the circle using constructor.

Q5.b

Write a Java program to find the maximum occurring character in a string. The given string is "test string".

Q.6

Q6.a

What is JVM? Write the functionality of each component with the help of block diagram. [Note: Question text reconstructed/partially unreadable]

Q6.b

Discuss about polymorphism. Explain run-time polymorphism with a program.

Q.7

Q7.a

Write the differences between method overloading and method overriding with suitable example of each.

Q7.b

Write a Java program to demonstrate example of hierarchical inheritance to get square and cube of a number.

Q.8

Q8.a

Design an abstract class named Vegetable with three subclasses named Potato, Brinjal and Tomato. Use appropriate data members and member functions to display the output of each vegetable. [Note: Question text reconstructed/partially unreadable]

Q.9

Q9.a

Write a JDBC program to update the amount balance in an account after every withdrawal. Assume the necessary database table.

Q9.b

Write an Applet to draw a smiley picture that accepts user name as a parameter and displays 'welcome' message.


2018 051529

B.Tech 5th Semester Exam., 2018

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Answer/Fill in the blank/Choose the correct option (any seven):

Q1.1

Java is an example of ________ language.

a)

compiled

b)

interpreted

c)

hybrid

d)

script

Q1.2

The mother tongue of a computer is:

a)

assembly language

b)

machine language

c)

BASIC language

d)

None of the above

Q1.3

You have the following code in a file called Test.java:

class Base{
    public static void main(String[] args){
        System.out.println("Hello");
    }
}
public class Test extends Base{}
What will happen if you try to compile and run this?

a)

It will fail to compile

b)

Runtime error

c)

Compiles and runs with no output

d)

Compiles and runs printing "Hello"

Q1.4

Which of the following are valid declarations? (Note: None of the literals used here contain the character O, they are all zeroes.)

a)

int i = 0XCAFE;

b)

boolean b = 0;

c)

byte b = 128;

d)

char c = 'A';

Q1.5

What is the result of trying to compile and run this program?

public class Test{
    public static void main(String[] args){
        int[] a = {1};
        Test t = new Test();
        t.increment(a);
        System.out.println(a[a.length-1]);
    }
    void increment(int[] i){
        i[i.length - 1]++;
    }
}

a)

Compiler error

b)

Compiles and runs printing out 2

c)

Compiles and runs printing out 1

d)

An ArrayIndexOutOfBoundsException at runtime

Q1.6

Is this legal?

long longArr[];
int intArr[] = {7, 8, 9};
longArr = intArr;

a)

Yes

b)

No

Q1.7

What is the result of attempting to compile and run this?

interface A{
    void aMethod();
}
public class Test implements A{
    void aMethod(){
        System.out.println("hello");
    }
    public static void main(String[] args){
        Test t = new Test();
        t.aMethod();
    }
}

a)

The code will not compile

b)

Runtime exception

c)

Compiles and runs printing out "hello"

Q1.8

What are the class variables?

Q1.9

Explain the following code sample:
result = someCondition ? value1 : value2;

Q1.10

Character strings are represented by the class java.lang.String.

Q.2 Solve both questions :

Q2.1

Why is Java called machine independent language? Explain the functionality of JVM.

Q2.2

What is the main difference between an application and applet?

Q.3 Solve both questions :

Q3.1

What are the wrapper classes? Explain their uses.

Q3.2

What does a dynamic Billboard Applet do? What are the three main classes that the applet contain?

Q.4 Solve both questions :

Q4.1

What is the difference between process-based and thread-based multitasking? Give the two ways by which a thread can be created using Java.

Q4.2

What is RMI? What is the difference between Naming.bind and Naming.rebind methods? Write a short code to invoke a remote method using Java RMI.

Q.5 Solve this question :

Q5.1

Write an Applet (Use swings) to display the outputs:

Question Diagram Question Diagram

Q.6 Solve both questions :

Q6.1

What are the characteristics of JDBC? What are the various steps for using JDBC? Write a program to demonstrate these steps.

Q6.2

What is the main purpose of a container component in swing?

Q.7 Solve this question :

Q7.1

Design a class named Fan to represent a fan. The class contains:
• Three constants named SLOW, MEDIUM and FAST with values 1, 2 and 3 to denote the fan speed.
• A private int data field named speed that specifies the speed of the fan (default SLOW).
• A private boolean data field named on that specifies whether the fan is on (default false).
• A private double data field named radius that specifies the radius of the fan (default 5).
• A string data field named colour that specifies the colour of the fan (default blue).
• The accessor and mutator methods for all four data fields.
• A no-arg constructor that creates a default fan.
• A method named toString() that returns a string description for the fan. If the fan is on, the method returns the fan speed, colour, and radius in one combined string. If the fan is not on, the method returns fan colour and radius along with the string "fan is off" in one combined string.

Implement the class. Write a test program that creates two Fan objects. Assign maximum speed, radius 10, colour yellow, and turn it onto the first object. Assign medium speed, radius 5, colour blue, and turn it off to the second object. Display the objects by invoking their toString method.

Q.8 Solve this question :

Q8.1

Write a program in Java to demonstrate communication using TCP/IP i.e., using sockets. Write a separate code for a server and client program. The program should display the contents of the file specified in a server onto the client.

Q.9 Write short notes on the following:

Q9.1
a)

Interface

b)

String builder class

c)

Object passing

d)

Types of JDBC drivers

e)

Listener method

f)

Java exceptions

g)

Polymorphism


2018 V4 051529

B.Tech 5th Semester Exam., 2018

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Answer/Fill in the blank/Choose the correct option (any seven):

Q1.1

Java is an example of ________ language.

a)

compiled

b)

interpreted

c)

hybrid

d)

script

Q1.2

The mother tongue of a computer is:

a)

assembly language

b)

machine language

c)

BASIC language

d)

None of the above

Q1.3

You have the following code in a file called Test.java:

class Base{
    public static void main(String[] args){
        System.out.println("Hello");
    }
}
public class Test extends Base{}
What will happen if you try to compile and run this?

a)

It will fail to compile

b)

Runtime error

c)

Compiles and runs with no output

d)

Compiles and runs printing "Hello"

Q1.4

Which of the following are valid declarations? (Note: None of the literals used here contain the character O, they are all zeroes.)

a)

int i = 0XCAFE;

b)

boolean b = 0;

c)

byte b = 128;

d)

char c = 'A';

Q1.5

What is the result of trying to compile and run this program?

public class Test{
    public static void main(String[] args){
        int[] a = {1};
        Test t = new Test();
        t.increment(a);
        System.out.println(a[a.length-1]);
    }
    void increment(int[] i){
        i[i.length - 1]++;
    }
}

a)

Compiler error

b)

Compiles and runs printing out 2

c)

Compiles and runs printing out 1

d)

An ArrayIndexOutOfBoundsException at runtime

Q1.6

Is this legal?

long longArr[];
int intArr[] = {7, 8, 9};
longArr = intArr;

a)

Yes

b)

No

Q1.7

What is the result of attempting to compile and run this?

interface A{
    void aMethod();
}
public class Test implements A{
    void aMethod(){
        System.out.println("hello");
    }
    public static void main(String[] args){
        Test t = new Test();
        t.aMethod();
    }
}

a)

The code will not compile

b)

Runtime exception

c)

Compiles and runs printing out "hello"

Q1.8

What are the class variables?

Q1.9

Explain the following code sample:
result = someCondition ? value1 : value2;

Q1.10

Character strings are represented by the class java.lang.String.

Q.2 Solve both questions :

Q2.1

Why is Java called machine independent language? Explain the functionality of JVM.

Q2.2

What is the main difference between an application and applet?

Q.3 Solve both questions :

Q3.1

What are the wrapper classes? Explain their uses.

Q3.2

What does a dynamic Billboard Applet do? What are the three main classes that the applet contain?

Q.4 Solve both questions :

Q4.1

What is the difference between process-based and thread-based multitasking? Give the two ways by which a thread can be created using Java.

Q4.2

What is RMI? What is the difference between Naming.bind and Naming.rebind methods? Write a short code to invoke a remote method using Java RMI.

Q.5 Solve this question :

Q5.1

Write an Applet (Use swings) to display the outputs:

Question Diagram Question Diagram

Q.6 Solve both questions :

Q6.1

What are the characteristics of JDBC? What are the various steps for using JDBC? Write a program to demonstrate these steps.

Q6.2

What is the main purpose of a container component in swing?

Q.7 Solve this question :

Q7.1

Design a class named Fan to represent a fan. The class contains:
• Three constants named SLOW, MEDIUM and FAST with values 1, 2 and 3 to denote the fan speed.
• A private int data field named speed that specifies the speed of the fan (default SLOW).
• A private boolean data field named on that specifies whether the fan is on (default false).
• A private double data field named radius that specifies the radius of the fan (default 5).
• A string data field named colour that specifies the colour of the fan (default blue).
• The accessor and mutator methods for all four data fields.
• A no-arg constructor that creates a default fan.
• A method named toString() that returns a string description for the fan. If the fan is on, the method returns the fan speed, colour, and radius in one combined string. If the fan is not on, the method returns fan colour and radius along with the string "fan is off" in one combined string.

Implement the class. Write a test program that creates two Fan objects. Assign maximum speed, radius 10, colour yellow, and turn it onto the first object. Assign medium speed, radius 5, colour blue, and turn it off to the second object. Display the objects by invoking their toString method.

Q.8 Solve this question :

Q8.1

Write a program in Java to demonstrate communication using TCP/IP i.e., using sockets. Write a separate code for a server and client program. The program should display the contents of the file specified in a server onto the client.

Q.9 Write short notes on the following:


2017 051529

B.Tech 5th Semester Exam., 2017

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer of any seven of the following:

Q1.1

Size (in bytes) of float and double in Java is:

a)

4 and 8

b)

8 and 8

c)

4 and 4

d)

8 and 4

Q1.2

Which of the following operators is used to allocate memory to array variable in Java?

a)

malloc

b)

alloc

c)

new

d)

new malloc

Q1.3

Which of the following is an incorrect array declaration?

a)

int arr[] = new int[5]

b)

int [] arr = new int[5]

c)

int arr[] = int[5] new

d)

None of the above

Q1.4

Which of the following is used as default for a member of a class if no access specifier is used for it?

a)

private

b)

public

c)

protected

d)

None of the above (default/package-private)

Q1.5

Which of the following methods of string class is used to obtain character at specified index?

a)

char()

b)

Charat()

c)

charat()

d)

charAt()

Q1.6

What does AWT stand for?

a)

All Window Tools

b)

All Writing Tools

c)

Abstract Window Toolkit

d)

Abstract Writing Toolkit

Q1.7

Which of the following keywords is used to prevent the content of a variable from being modified?

a)

final

b)

last

c)

constant

d)

static

Q1.8

Which of the following functions is used to perform some actions when the object is to be destroyed?

a)

finalize()

b)

delete()

c)

main()

d)

None of the above

Q1.9

What is the order of precedence (highest to lowest) of the following operators?
1. &&
2. ==
3. ?:

a)

1 -> 2 -> 3

b)

2 -> 1 -> 3

c)

3 -> 2 -> 1

d)

2 -> 3 -> 1

Q1.10

Which of the following classes is related to all the exceptions that can be caught by using catch?

a)

Error

b)

Exception

c)

RuntimeException

d)

All of the above

Q.2 Solve both questions :

Q2.1

What are the various access specifiers for JAVA classes? Discuss the various types of inheritance supported by JAVA.

Q2.2

Discuss the different types of operators in JAVA along with their precedence relationship.

Q.3 Solve both questions :

Q3.1

What is JDBC connection? Explain the types of JAVA drivers available for database connectivity. List the advantages and disadvantages of each of the mentioned JAVA drivers.

Q3.2

What is the difference between final, finally and finalize in JAVA? Compare and contrast between 'throw' and 'throws'.

Q.4 Solve both questions :

Q4.1

What is a thread? Explain the different states in which a thread can exist. Why does a dead thread occur? What are the actions that can occur when a thread enters blocked state?

Q4.2

Explain the various OOPs concepts in JAVA.

Q.5 Solve both questions :

Q5.1

What is an immutable class? How to create an immutable class?

Q5.2

What is an abstract class? Explain with example. Differentiate between abstract class and interfaces. What are the advantages of interfaces over abstract classes?

Q.6 Solve both questions :

Q6.1

What are applets? Which package contains the applet class? Explain the applet life cycle methods.

Q6.2

What is the difference between swing and applet? How is a frame created and closed in an applet?

Q.7 Solve both questions :

Q7.1

How can we restrict inheritance for a class? Does JAVA support multiple inheritance? Justify your answer.

Q7.2

Write a program to insert an element at the last index of an array in JAVA.

Q.8 Solve both questions :

Q8.1

Explain the concept of static methods with suitable examples.

Q8.2

What is event handling? What are the steps involved in event handling?


2017 V4 051529

B.Tech 5th Semester Exam., 2017

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Q.1 Choose the correct answer of any seven of the following:

Q1.1

Size (in bytes) of float and double in Java is:

a)

4 and 8

b)

8 and 8

c)

4 and 4

d)

8 and 4

Q1.2

Which of the following operators is used to allocate memory to array variable in Java?

a)

malloc

b)

alloc

c)

new

d)

new malloc

Q1.3

Which of the following is an incorrect array declaration?

a)

int arr[] = new int[5]

b)

int [] arr = new int[5]

c)

int arr[] = int[5] new

d)

None of the above

Q1.4

Which of the following is used as default for a member of a class if no access specifier is used for it?

a)

private

b)

public

c)

protected

d)

None of the above (default/package-private)

Q1.5

Which of the following methods of string class is used to obtain character at specified index?

a)

char()

b)

Charat()

c)

charat()

d)

charAt()

Q1.6

What does AWT stand for?

a)

All Window Tools

b)

All Writing Tools

c)

Abstract Window Toolkit

d)

Abstract Writing Toolkit

Q1.7

Which of the following keywords is used to prevent the content of a variable from being modified?

a)

final

b)

last

c)

constant

d)

static

Q1.8

Which of the following functions is used to perform some actions when the object is to be destroyed?

a)

finalize()

b)

delete()

c)

main()

d)

None of the above

Q1.9

What is the order of precedence (highest to lowest) of the following operators?
1. &&
2. ==
3. ?:

a)

1 -> 2 -> 3

b)

2 -> 1 -> 3

c)

3 -> 2 -> 1

d)

2 -> 3 -> 1

Q1.10

Which of the following classes is related to all the exceptions that can be caught by using catch?

a)

Error

b)

Exception

c)

RuntimeException

d)

All of the above

Q.2 Solve both questions :

Q2.1

What are the various access specifiers for JAVA classes? Discuss the various types of inheritance supported by JAVA.

Q2.2

Discuss the different types of operators in JAVA along with their precedence relationship.

Q.3 Solve both questions :

Q3.1

What is JDBC connection? Explain the types of JAVA drivers available for database connectivity. List the advantages and disadvantages of each of the mentioned JAVA drivers.

Q3.2

What is the difference between final, finally and finalize in JAVA? Compare and contrast between 'throw' and 'throws'.

Q.4 Solve both questions :

Q4.1

What is a thread? Explain the different states in which a thread can exist. Why does a dead thread occur? What are the actions that can occur when a thread enters blocked state?

Q4.2

Explain the various OOPs concepts in JAVA.

Q.5 Solve both questions :

Q5.1

What is an immutable class? How to create an immutable class?

Q5.2

What is an abstract class? Explain with example. Differentiate between abstract class and interfaces. What are the advantages of interfaces over abstract classes?

Q.6 Solve both questions :

Q6.1

What are applets? Which package contains the applet class? Explain the applet life cycle methods.

Q6.2

What is the difference between swing and applet? How is a frame created and closed in an applet?

Q.7 Solve both questions :

Q7.1

How can we restrict inheritance for a class? Does JAVA support multiple inheritance? Justify your answer.

Q7.2

Write a program to insert an element at the last index of an array in JAVA.

Q.8 Solve both questions :

Q8.1

Explain the concept of static methods with suitable examples.

Q8.2

What is event handling? What are the steps involved in event handling?


2016 051529

B.Tech 5th Semester Examination, 2016

Time 3 hours
Full Marks 70
Instructions:
  • There are Nine Questions in this Paper.
  • Attempt five questions in all.
  • Question No. 1 is Compulsory.
  • The questions are of equal value.

Q.1 Choose the correct answer of the following (any seven)

Q1.1

What is the output of this program?

a)

42 42

b)

43 43

c)

42 -43

d)

42 -42

Q1.2

Which of these have highest precedence?

a)

()

b)

++

c)
d)
Q1.3

What is the output of this program?

a)

10

b)

11

c)

12

d)

56

Q1.4

What is the output of this program?

a)

11 11

b)

11 10

c)

10 10

d)

10 11

Q1.5

What is the output of this program?

a)

38 -43

b)

39 44

c)

295 300

d)

295.04 300

Q1.6

What is the default value of Boolean variable?

a)

true

b)

false

c)

null

d)

not defined

Q1.7

What is the output of this program?

a)

1 1 1 1 1

b)

1 1 1 1 1 1 1 1 1 1

c)

0 1 2 3 4

d)

None of the mentioned

Q1.8

What is the output of this program?

a)

Hello

b)

World

c)

Hello world

d)

Hello world (with Exception thrown)

Q1.9

What is the output of this program?

a)

6

b)

7

c)

8

d)

9

Q1.10

What is the output of this program?

a)

2 2

b)

3 3

c)

Runtime Error

d)

Compilation Error

Q.2 Solve both questions :

Q2.1

What is the difference between the C, C++ and Java?

Q2.2

Write a program that reads an integer and check whether it is prime number or not.

Q.3 Solve both questions :

Q3.1

What do you understand by polymorphism? Explain with examples.

Q3.2

What do you understand by precedence and Associativity? Explain with examples.

Q.4 Solve both questions :

Q4.1

What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.

Q4.2

What is exception-handling? What are the statements used for it? Show an example.

Q.5 Solve both questions :

Q5.1

Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.

Q5.2

Difference between the following with example: i. Break and continue, ii. Abstract class and interface.

Q.6 Solve both questions :

Q6.1

What is exception-handling? What are the statements used for it? Show an example.

Q6.2

What is inheritance in java? Explain different types of inheritance.

Q.7 Solve both questions :

Q7.1

Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.

Q7.2

Write a program to find largest and second largest element in an array.

Q.8 Solve both questions :

Q8.1

Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).

Q8.2

Write a program to create a thread that Implement the Runnable interface.

Q.9 Solve both questions :

Q9.1

Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.

Q9.2

Write a program to find the factorial of a given number using Recursion.


2016 V2 051529

B.Tech 5th Semester Examination, 2016

Time 3 hours
Full Marks 70
Instructions:
  • There are Nine Questions in this Paper.
  • Attempt five questions in all.
  • Question No. 1 is Compulsory.
  • The questions are of equal value.

Q.1 Choose the correct answer of the following (any seven)

Q1.1

What is the output of this program?

a)

42 42

b)

43 43

c)

42 -43

d)

42 -42

Q1.2

Which of these have highest precedence?

a)

()

b)

++

c)
d)

>>

Q1.3

What is the output of this program?

a)

10

b)

11

c)

12

d)

56

Q1.4

What is the output of this program?

a)

11 11

b)

11 10

c)

10 10

d)

10 11

Q1.5

What is the output of this program?

a)

38 -43

b)

39 44

c)

295 300

d)

295.04 300

Q1.6

What is the default value of Boolean variable?

a)

true

b)

false

c)

null

d)

not defined

Q1.7

What is the output of this program?

a)

1 1 1 1 1

b)

1 1 1 1 1 1 1 1 1 1

c)

0 1 2 3 4

d)

None of the mentioned

Q1.8

What is the output of this program?

a)

Hello

b)

World

c)

Hello world

d)

Hello world (with Exception thrown)

Q1.9

What is the output of this program?

a)

6

b)

7

c)

8

d)

9

Q1.10

What is the output of this program?

a)

2 2

b)

3 3

c)

Runtime Error

d)

Compilation Error

Q.2 Solve both questions :

Q2.1

What is the difference between the C, C++ and Java?

Q2.2

Write a program that reads an integer and check whether it is prime number or not.

Q.3 Solve both questions :

Q3.1

What do you understand by polymorphism? Explain with examples.

Q3.2

What do you understand by precedence and Associativity? Explain with examples.

Q.4 Solve both questions :

Q4.1

What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.

Q4.2

What is exception-handling? What are the statements used for it? Show an example.

Q.5 Solve both questions :

Q5.1

Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.

Q5.2

Difference between the following with example: i. Break and continue, ii. Abstract class and interface.

Q.6 Solve both questions :

Q6.1

What is exception-handling? What are the statements used for it? Show an example.

Q6.2

What is inheritance in java? Explain different types of inheritance.

Q.7 Solve both questions :

Q7.1

Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.

Q7.2

Write a program to find largest and second largest element in an array.

Q.8 Solve both questions :

Q8.1

Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).

Q8.2

Write a program to create a thread that Implement the Runnable interface.

Q.9 Solve both questions :

Q9.1

Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.

Q9.2

Write a program to find the factorial of a given number using Recursion.


2016 V3 051529

B.Tech 5th Semester Examination, 2016

Time 3 hours
Full Marks 70
Instructions:
  • There are Nine Questions in this Paper.
  • Attempt five questions in all.
  • Question No. 1 is Compulsory.
  • The questions are of equal value.

Q.1 Choose the correct answer of the following (any seven)

Q1.1

What is the output of this program?

a)

42 42

b)

43 43

c)

42 -43

d)

42 -42

Q1.2

Which of these have highest precedence?

a)

()

b)

++

c)
d)

>>

Q1.3

What is the output of this program?

a)

10

b)

11

c)

12

d)

56

Q1.4

What is the output of this program?

a)

11 11

b)

11 10

c)

10 10

d)

10 11

Q1.5

What is the output of this program?

a)

38 -43

b)

39 44

c)

295 300

d)

295.04 300

Q1.6

What is the default value of Boolean variable?

a)

true

b)

false

c)

null

d)

not defined

Q1.7

What is the output of this program?

a)

1 1 1 1 1

b)

1 1 1 1 1 1 1 1 1 1

c)

0 1 2 3 4

d)

None of the mentioned

Q1.8

What is the output of this program?

a)

Hello

b)

World

c)

Hello world

d)

Hello world (with Exception thrown)

Q1.9

What is the output of this program?

a)

6

b)

7

c)

8

d)

9

Q1.10

What is the output of this program?

a)

2 2

b)

3 3

c)

Runtime Error

d)

Compilation Error

Q.2 Solve both questions :

Q2.1

What is the difference between the C, C++ and Java?

Q2.2

Write a program that reads an integer and check whether it is prime number or not.

Q.3 Solve both questions :

Q3.1

What do you understand by polymorphism? Explain with examples.

Q3.2

What do you understand by precedence and Associativity? Explain with examples.

Q.4 Solve both questions :

Q4.1

What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.

Q4.2

What is exception-handling? What are the statements used for it? Show an example.

Q.5 Solve both questions :

Q5.1

Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.

Q5.2

Difference between the following with example: i. Break and continue, ii. Abstract class and interface.

Q.6 Solve both questions :

Q6.1

What is exception-handling? What are the statements used for it? Show an example.

Q6.2

What is inheritance in java? Explain different types of inheritance.

Q.7 Solve both questions :

Q7.1

Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.

Q7.2

Write a program to find largest and second largest element in an array.

Q.8 Solve both questions :

Q8.1

Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).

Q8.2

Write a program to create a thread that Implement the Runnable interface.

Q.9 Solve both questions :

Q9.1

Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.

Q9.2

Write a program to find the factorial of a given number using Recursion.


2016 V4 051529

B.Tech 5th Semester Examination, 2016

Time 3 hours
Full Marks 70
Instructions:
  • There are Nine Questions in this Paper.
  • Attempt five questions in all.
  • Question No. 1 is Compulsory.
  • The questions are of equal value.

Q.1 Choose the correct answer of the following (any seven)

Q1.1

What is the output of this program?

class bitwise_operator {
    public static void main (String args[]) {
        int var1 = 42;
        int var2 = ~var1;
        System.out.print(var1 + " " + var2);
    }
}

a)

42 42

b)

43 43

c)

42 -43

d)

42 -42

Q1.2

Which of these have highest precedence?

a)

()

b)

++

c)
d)

>>

Q1.3

What is the output of this program?

class operators {
    public static void main(String args[]) {
        int var1 = 5;
        int var2 = 6;
        int var3;
        var3 = ++var2 * var1 / var2 + var2;
        System.out.print(var3);
    }
}

a)

10

b)

11

c)

12

d)

56

Q1.4

What is the output of this program?

class output {
    public static void main(String args[]) {
        int x, y;
        x = 10;
        x++;
        --x;
        y = x++;
        System.out.println(x + " " + y);
    }
}

a)

11 11

b)

11 10

c)

10 10

d)

10 11

Q1.5

What is the output of this program?

class conversion {
    public static void main(String args[]) {
        double a = 295.04;
        int b = 300;
        byte c = (byte) a;
        byte d = (byte) b;
        System.out.println(c + " " + d);
    }
}

a)

38 -43

b)

39 44

c)

295 300

d)

295.04 300

Q1.6

What is the default value of Boolean variable?

a)

true

b)

false

c)

null

d)

not defined

Q1.7

What is the output of this program?

class array_output {
    public static void main(String args[]) {
        char array_variable[] = new char[10];
        for (int i=0; i<10; ++i) {
            array_variable[i] = '1';
            System.out.print(array_variable[i] + " ");
            i++;
        }
    }
}

a)

1 1 1 1 1

b)

1 1 1 1 1 1 1 1 1 1

c)

0 1 2 3 4

d)

None of the mentioned

Q1.8

What is the output of this program?

class exception_handling {
    public static void main(String args[]) {
        try {
            System.out.print("Hello" + " " + 1/0);
        } catch (ArithmeticException e) {
            System.out.print("World");
        }
    }
}

a)

Hello

b)

World

c)

Hello world

d)

Hello world (with Exception thrown)

Q1.9

What is the output of this program?

class overload {
    int y;
    int x;
    void add(int a) {
        x = a + 1;
    }
    void add(int a, int b) {
        x = a + 2;
    }
}
class overload_methods {
    public static void main(String args[]) {
        overload obj = new overload();
        int a = 0;
        obj.add(6, 7);
        System.out.println(obj.x);
    }
}

a)

6

b)

7

c)

8

d)

9

Q1.10

What is the output of this program?

class A {
    public int i;
    private int j;
}
class B extends A {
    void display() {
        super.j = super.i + 1;
        System.out.println(super.i + " " + super.j);
    }
}
class inheritance {
    public static void main(String args[]) {
        B obj = new B();
        obj.i = 1;
        obj.j = 2;
        obj.display();
    }
}

a)

2 2

b)

3 3

c)

Runtime Error

d)

Compilation Error

Q.2 Solve both questions :

Q2.1

What is the difference between the C, C++ and Java?

Q2.2

Write a program that reads an integer and check whether it is prime number or not.

Q.3 Solve both questions :

Q3.1

What do you understand by polymorphism? Explain with examples.

Q3.2

What do you understand by precedence and Associativity? Explain with examples.

Q.4 Solve both questions :

Q4.1

What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.

Q4.2

What is exception-handling? What are the statements used for it? Show an example.

Q.5 Solve both questions :

Q5.1

Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.

Q5.2

Difference between the following with example: i. Break and continue, ii. Abstract class and interface.

Q.6 Solve both questions :

Q6.1

What is exception-handling? What are the statements used for it? Show an example.

Q6.2

What is inheritance in java? Explain different types of inheritance.

Q.7 Solve both questions :

Q7.1

Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.

Q7.2

Write a program to find largest and second largest element in an array.

Q.8 Solve both questions :

Q8.1

Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).

Q8.2

Write a program to create a thread that Implement the Runnable interface.

Q.9 Solve both questions :

Q9.1

Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.

Q9.2

Write a program to find the factorial of a given number using Recursion.


2016 V5 051529

B.Tech 5th Semester Examination, 2016

Time 3 hours
Full Marks 70
Instructions:
  • There are Nine Questions in this Paper.
  • Attempt five questions in all.
  • Question No. 1 is Compulsory.
  • The questions are of equal value.

Q.1 Choose the correct answer of the following (any seven)

Q1.1

What is the output of this program?

class bitwise_operator {
    public static void main (String args[]) {
        int var1 = 42;
        int var2 = ~var1;
        System.out.print(var1 + " " + var2);
    }
}

a)

42 42

b)

43 43

c)

42 -43

d)

42 -42

Q1.2

Which of these have highest precedence?

a)

()

b)

++

c)
d)

>>

Q1.3

What is the output of this program?

class operators {
    public static void main(String args[]) {
        int var1 = 5;
        int var2 = 6;
        int var3;
        var3 = ++var2 * var1 / var2 + var2;
        System.out.print(var3);
    }
}

a)

10

b)

11

c)

12

d)

56

Q1.4

What is the output of this program?

class output {
    public static void main(String args[]) {
        int x, y;
        x = 10;
        x++;
        --x;
        y = x++;
        System.out.println(x + " " + y);
    }
}

a)

11 11

b)

11 10

c)

10 10

d)

10 11

Q1.5

What is the output of this program?

class conversion {
    public static void main(String args[]) {
        double a = 295.04;
        int b = 300;
        byte c = (byte) a;
        byte d = (byte) b;
        System.out.println(c + " " + d);
    }
}

a)

38 -43

b)

39 44

c)

295 300

d)

295.04 300

Q1.6

What is the default value of Boolean variable?

a)

true

b)

false

c)

null

d)

not defined

Q1.7

What is the output of this program?

class array_output {
    public static void main(String args[]) {
        char array_variable[] = new char[10];
        for (int i=0; i<10; ++i) {
            array_variable[i] = '1';
            System.out.print(array_variable[i] + " ");
            i++;
        }
    }
}

a)

1 1 1 1 1

b)

1 1 1 1 1 1 1 1 1 1

c)

0 1 2 3 4

d)

None of the mentioned

Q1.8

What is the output of this program?

class exception_handling {
    public static void main(String args[]) {
        try {
            System.out.print("Hello" + " " + 1/0);
        } catch (ArithmeticException e) {
            System.out.print("World");
        }
    }
}

a)

Hello

b)

World

c)

Hello world

d)

Hello world (with Exception thrown)

Q1.9

What is the output of this program?

class overload {
    int y;
    int x;
    void add(int a) {
        x = a + 1;
    }
    void add(int a, int b) {
        x = a + 2;
    }
}
class overload_methods {
    public static void main(String args[]) {
        overload obj = new overload();
        int a = 0;
        obj.add(6, 7);
        System.out.println(obj.x);
    }
}

a)

6

b)

7

c)

8

d)

9

Q1.10

What is the output of this program?

class A {
    public int i;
    private int j;
}
class B extends A {
    void display() {
        super.j = super.i + 1;
        System.out.println(super.i + " " + super.j);
    }
}
class inheritance {
    public static void main(String args[]) {
        B obj = new B();
        obj.i = 1;
        obj.j = 2;
        obj.display();
    }
}

a)

2 2

b)

3 3

c)

Runtime Error

d)

Compilation Error

Q.2 Solve both questions :

Q2.1

What is the difference between the C, C++ and Java?

Q2.2

Write a program that reads an integer and check whether it is prime number or not.

Q.3 Solve both questions :

Q3.1

What do you understand by polymorphism? Explain with examples.

Q3.2

What do you understand by precedence and Associativity? Explain with examples.

Q.4 Solve both questions :

Q4.1

What is a constructor? Give its properties. How do we declare/define it? Can they be overloaded? Explain types of constructors with example.

Q4.2

What is exception-handling? What are the statements used for it? Show an example.

Q.5 Solve both questions :

Q5.1

Give the definition (1-2 Lines) and an example of the following: i. Thread Class, ii. AWT, iii. JDBC, iv. JVM.

Q5.2

Difference between the following with example: i. Break and continue, ii. Abstract class and interface.

Q.6 Solve both questions :

Q6.1

What is exception-handling? What are the statements used for it? Show an example.

Q6.2

What is inheritance in java? Explain different types of inheritance.

Q.7 Solve both questions :

Q7.1

Create an abstract class Discount Policy. It should have a single abstract method compute Discount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost.

Q7.2

Write a program to find largest and second largest element in an array.

Q.8 Solve both questions :

Q8.1

Write a program to design a class account using the inheritance and static keyword that shows all function of bank (withdrawal, deposit).

Q8.2

Write a program to create a thread that Implement the Runnable interface.

Q.9 Solve both questions :

Q9.1

Write a program to create a Simple class to find out the Area and perimeter of rectangle and box using super and this keyword.

Q9.2

Write a program to find the factorial of a given number using Recursion.


2015 051529

B.Tech Examination, 2015

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Answer any seven of the following questions :

a)

Define hardware and software.

b)

What is the JVM?

c)

What are the input and output of a Java compiler?

d)

What are the benefits of using constants?

e)

Can different types of numeric values be used together in computation?

f)

List six comparison operators.

g)

Write an if statement that assigns 1 to xx, if yy is greater than 0.

h)

What are the differences between a while loop and a do-while loop?

i)

How do you access elements of an array?

j)

How do you determine whether a character is alphanumeric?

Q2

Answer the following:

a)

Write a Java Programming that displays 'Welcome to Java' five times.

b)

Describe the history of Java. Can Java run on any machine?

Q3

Answer the following:

a)

Describe syntax errors, runtime errors and logic errors.

b)

Write a program that reads an integer and check. Whether it is even?

Q4

Answer the following:

a)

Write a program that displays a random uppercase letter.

b)

Write a program to sum the following series : $\frac{1}{3} + \frac{3}{5} + \frac{5}{7} + \frac{7}{9} + \frac{9}{11} + \frac{11}{13} + \dots + \frac{95}{97} + \frac{97}{99}$

Q5

Answer the following:

a)

Explain method abstraction and stepwise refinement.

b)

Declare and create a 4-by-5 int matrix.

Q6

Answer the following:

a)

Write a program that reads in eleven numbers and displays duplicate numbers.

b)

How does a scanner work? Explain.

Q7

Answer the following:

a)

Write a program that removes all the occurrences of a specified string from a text file.

b)

Explain the protected data and methods.

Q8

Answer the following:

a)

What is encapsulation? What are the benefits of data field encapsulation?

b)

Describe the HTML tag. How do you pass parameters to an applet?

Q9

Write short notes on any four of the following :

a)

JDBC

b)

Thread communication

c)

Polymorphism

d)

Factory methods

e)

AWT components


2014 051529

B.Tech Examination, 2014

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Answer any seven questions :

a)

Which of the following functions is performed by a constructor?

a)

Construct a new class

b)

Construct a new object

c)

Construct a new function

d)

Initialize objects

b)

Which of the following factors supports the statement that reusability is a desirable feature of a language?

a)

It decreases the testing time

b)

It lowers the maintenance cost

c)

It reduces the compilation time

d)

Both (i) and (ii)

c)

Which will legally declare, construct and initialize an array?

a)

int [ ] myList = {"1", "2", "3"};

b)

int [ ] myList = {5, 8, 2};

c)

int myList [ ] [ ] = {4, 9, 7, 0};

d)

int myList [ ] = {4, 3, 7};

d)

What is the numerical range of a char?

a)

-128 to 127

b)

-(2^{15}) to (2^{15}) - 1

c)

0 to 32767

d)

0 to 65535

e)

Public class Test {} What is the prototype of the default constructor?

a)

Test()

b)

Test(void)

c)

public Test()

d)

public Test(void)

f)

Which of the following provides a reuse mechanism?

a)

Abstraction

b)

Inheritance

c)

Dynamic binding

d)

Encapsulation

g)

Which is not a valid comment style in Java?

a)

/* comment */

b)

/* comment

c)

/** comment */

d)

// comment

h)

What is the correct signature of the main method?

a)

public static void main (String[] args)

b)

static public void main (String[] args)

c)

public void main (String[] args)

d)

Both (i) and (ii)

i)

Which of the following statements is correct?

a)

Class is an instance of object

b)

Object is an instance of class

c)

Class is an instance of data type

d)

Object is an instance of data type

j)

Which keyword is used to inherit class?

a)

Inherit

b)

Extends

c)

Inheritance

d)

Extend

Q2

Answer the following:

a)

Explain the main features of object-oriented programming language.

b)

List the eight basic data types used in Java. Give examples.

Q3

Answer the following:

a)

Discuss the Java error handling mechanism. What is the difference between runtime (unchecked) exceptions and checked exceptions? What is the implication of catching all the exceptions with the type 'Exception'?

b)

Explain abstract class with a program. What is the Java virtual machine?

Q4

Answer the following:

a)

What is an applet?

b)

Write a Java program for applet to reverse a user inputted string.

Q5

Answer the following:

a)

What is the main difference between pass-by-reference and pass-by-value?

b)

What are access modifiers? Explain each of the access modifiers in Java.

Q6

Answer the following:

a)

What is AWT? What are the different AWT components in Java?

b)

Write a program in Java to create and close a frame.

Q7

Answer the following:

a)

What is the major difference between an interface and a class?

b)

Write a program to multiply two matrices A and B. (Assume A and B are two-dimensional matrices.)

Q8

Answer the following:

a)

Explain interface in a package.

b)

Create an applet which contains a Jpopup-Menu with the following items : New, Open, Cut, Copy, Paste. Display an appropriate message while clicking the respective menu items and print the output to the console.

Q9

Answer the following:

a)

Explain deadlock in threads with the help of a program.

b)

Write a program in Java to multiply two 2-dimensional matrices inputted from user.


2013 051529

B.Tech Examination, 2013

Time 3 hours
Full Marks 70
Instructions:
  • The marks are indicated in the right-hand margin.
  • There are NINE questions in this paper.
  • Attempt FIVE questions in all.
  • Question No. 1 is compulsory.

Questions

Q1

Answer any seven questions :

a)

Which of the following functions is performed by a constructor?

a)

Construct a new class

b)

Construct a new object

c)

Construct a new function

d)

Initialize objects

b)

Which of the following factors supports the statement that reusability is a desirable feature of a language?

a)

It decreases the testing time

b)

It lowers the maintenance cost

c)

It reduces the compilation time

d)

Both (i) and (ii)

c)

Which will legally declare, construct and initialize an array?

a)

int [ ] myList = {"1", "2", "3"};

b)

int [ ] myList = {5, 8, 2};

c)

int myList [ ] [ ] = {4, 9, 7, 0};

d)

int myList [ ] = {4, 3, 7};

d)

What is the numerical range of a char?

a)

-128 to 127

b)

-(2^{15}) to (2^{15}) - 1

c)

0 to 32767

d)

0 to 65535

e)

Public class Test {} What is the prototype of the default constructor?

a)

Test()

b)

Test(void)

c)

public Test()

d)

public Test(void)

f)

Which of the following provides a reuse mechanism?

a)

Abstraction

b)

Inheritance

c)

Dynamic binding

d)

Encapsulation

g)

Which is not a valid comment style in Java?

a)

/* comment */

b)

/* comment

c)

/** comment */

d)

// comment

h)

What is the correct signature of the main method?

a)

public static void main (String[] args)

b)

static public void main (String[] args)

c)

public void main (String[] args)

d)

Both (i) and (ii)

i)

Which of the following statements is correct?

a)

Class is an instance of object

b)

Object is an instance of class

c)

Class is an instance of data type

d)

Object is an instance of data type

j)

Which keyword is used to inherit class?

a)

Inherit

b)

Extends

c)

Inheritance

d)

Extend

Q2

Answer the following:

a)

Explain the main features of object-oriented programming language.

b)

List the eight basic data types used in Java. Give examples.

Q3

Answer the following:

a)

Discuss the Java error handling mechanism. What is the difference between runtime (unchecked) exceptions and checked exceptions? What is the implication of catching all the exceptions with the type 'Exception'?

b)

Explain abstract class with a program. What is the Java virtual machine?

Q4

Answer the following:

a)

What is an applet?

b)

Write a Java program for applet to reverse a user inputted string.

Q5

Answer the following:

a)

What is the main difference between pass-by-reference and pass-by-value?

b)

What are access modifiers? Explain each of the access modifiers in Java.

Q6

Answer the following:

a)

What is AWT? What are the different AWT components in Java?

b)

Write a program in Java to create and close a frame.

Q7

Answer the following:

a)

What is the major difference between an interface and a class?

b)

Write a program to multiply two matrices A and B. (Assume A and B are two-dimensional matrices.)

Q8

Answer the following:

a)

Explain interface in a package.

b)

Create an applet which contains a Jpopup-Menu with the following items : New, Open, Cut, Copy, Paste. Display an appropriate message while clicking the respective menu items and print the output to the console.

Q9

Answer the following:

a)

Explain deadlock in threads with the help of a program.

b)

Write a program in Java to multiply two 2-dimensional matrices inputted from user.


Install on iOS

To install BEU Connect on your iPhone:

1. Tap the Share button at the bottom of Safari.
2. Scroll down and tap "Add to Home Screen".