Phone:+91-88823 09876

amity assignment Java programming

 

Java programming

 

Assignment A

 

 

 

 

 

 

 

 

 

 

 

Programme              Bachelor of Science (Information Technology)                    Semester 5                Subject-  Java  programming

-

 

Assignment Submission                                                                                                                     Close      Final Submit

 

 

 

 

 

Case Detail :  Read the following and create appropriate java applets.

 

a.    Create  a  try block  that  is  likely  to  generate  two  types of  exception and  then  incorporate  necessary  catch block  to handle them appropriately

 

b)  Create a java applet  with a button  “Display”. On click of button  it should display Rectangle,  Oval and Circle within the

Applet.

c)   Create the following form in Java:-

 

Please give your answer in at least 25 words and  press save and  continue button.

 

S. No.   Questions                                                                                                                                                                                                       Marks - 10

 

1.         Subject should display name of subjects :-c++, VB, Java

 

 

2.         Foreign language should display choice of foreign languages French, German and  Japanese

3.         Submit button should submit the result

 

 

Assignment C

 

Question No: 1

 

 

Which of the following expressions will produce errors upon compilation?

 

 

 

(A) boolean a = (boolean) 1;

(B) boolean b = (false && true); (C) float y = 22.3;

 

 

(A) & (C) (A)

(A), (C) & (D) (A), (B) & (D)

 

Question No: 2

 

 

Which of the following expressions will produce errors upon compilation?

 

A) boolean a =(boolean) 1;

(B) boolean b = (false && true); (C) float y = 22.3;

A) & (C) (A)

(A), (C) & (D) (A), (B) & (D)

 

Question No: 3

 

 

The control expression in an "if" statement must be--

an expression with type boolean an expression with type integer

an expression with either the type boolean or integer

 

an expression with either the type boolean or integer with value 0 or 1

 

Question No: 4

 

 

Which of the following represent legal flow control statements?

 

(A) break; (B) break();

(C) continue outer; (D) continue(inner); (E) return;

(F) exit();

A), (C) & (E)

(A), (B) & (C) (A), (C) & (D) (A) & (E)

 

Question No: 5

Which of the following represent legal flow control statements?

Are there  any errors in the following class definition?

abstract class Class1

Class header definition is wrong Method definition is wrong Constructor needs to be defined No errors

 

Question No: 6

ith  javadoc, which of the following denotes a javadoc comment?

 

 

/**

 

//#

 

/*

 

//**

 

Question No: 7

Which javadoc tag is used to denote a comment for a method parameter?

 

@param                                                                                                                                                                                                                                                        

@method

@parameter

@argument

 

Question No: 8

What will be the result of the expression?

a % b

when a and b are of type int and their values are a = 10 and b = 6?

1.66

 

1

None of these

 

4

 

Question No: 9

 

Determine the output when the value of x is zero--

(x >= 0)

if(x > 0)

System.out.println("x is positive");

else

System.out.println("x is negative");

"x is negative"

"x is positive"                                                                                                                                                                                                                                                                                        

None of these

 

Question No: 10

 

 

Which of the following is correct  syntax for an Abstract class?

 

 

abstract double area() { } abstract double area() abstract double area(); abstract double area(); { }

 

Question No: 11

 

 

What is the output of following piece of code?

 

 

 

int x = 2;

switch (x) {

case 1:System.out.println(”1″);

case 2:

case 3:System.out.println(”3″);

case 4:

case 5:System.out.println(”5″);

}

 

 

 

 

No output

 

3 & 5

 

1, 3 & 5

 

3

 

Question No: 12

 

 

 

 

 

                       converts the java program to byte code.

 

 

Java Virtual Machine

 

Compiler

 

Java Libraries

 

Java Editor

 

Question No: 13

 

 

What would happen if you don’t include String args[] in the main method of any class?

 

 

No error Compile error Runtime Error

No error but goes to infinite loop

 

Question No: 14

 

 

JVM stands for--

 

 

Java Vision Mechanism Java Virtual Machine Java Virtual Model

Java Vertical Model

 

Question No: 15

 

 

Java consists of a ready-made package called--

 

 

Java Program

 

Java Applet

 

Java API

 

Java Widgets

 

Question No: 16

 

 

Java Platforms consists of --

 

 

Java Program and Applet

 

Java API and JVM

 

Java Widgets and Programmes

 

Java Virtual Machine and Applets

 

Question No: 17

 

 

Which of the following are not logical operators?

 

 

>> 

 

&&

 

!

 

^

 

Question No: 18

 

 

Java was developed by--

 

 

Microsoft

 

Sun  Microsystems

 

Borland

 

Siemens

 

Question No: 19

 

 

 

 

 

Which of the following variable is valid in Java?

 

 

variable1 variable2_n variable= variable 4

 

Question No: 20

 

 

What is the result of the following operation?

 

 

System.out.println (4 / 3)

 

 

6

 

0

 

1

 

7

 

Question No: 21

 

 

To compile a java file, path should be set to--

 

 

 

 

 

{ c:\is the drive where  jdk1.4 is installed}

 

 

c:\ jdk1.4\lib; c:\jdk1.4\bin; c:\jdk1.4\include; None of the above

 

Question No: 22

 

 

 

 

 

In java                   is the top hierarchy of the classes.                                                                                                                                                              

 

Class Name

 

Object

 

Main Method

 

Super Class

 

Question No: 23

 

 

Using the keyword                            , we can access value of the instance variables and class variables of that class inside the method of that class itself.

 

 

Super this final

Either final or this

 

Question No: 24

 

 

The number of arguments or the types of arguments is to be different for creating two or more methods with the same name are in--

 

 

Inheritance

 

Method overloading Method overriding Polymorphism

 

Question No: 25

 

 

The keyword ‘new’ will--

 

Create an instance of a object                                                                                                                                                                                                                                                         

 

 

ssigns a new value to the object

 

Create new object by instantiating the class

 

Question No: 26

 

 

What are the five layouts of AWT?

 

a)   BagGridLayout b)  FlowLayout

c)   GridLayout d)  BagLayout

e)   GridBagLayout f)   CardLayout

g)  BorderLayout

 

 

b c e f g a b c d e f g e d a a c b g e

 

Question No: 27

 

 

Events do not respond to--

 

 

 

 

Physical Action

                                                                                                              

 

 

 

Logical Action

Astrological Action                                                                                                                                                                                                                                                                              

 

All of the above

 

Question No: 28

 

 

Checkbox, Menu item, and choice List’s event  can be handled by --

 

 

Adjustment Listener

 

Item Listener Action Listener Text Listener

 

Question No: 29

 

 

Signature of the method includes--

 

 

 

 

 

Name of the Method

 

List of parameters

 

Return type of the method

 

Only a) and b)

 

Question No: 30

 

 

 

 

Break statement is used for--

 

 

 

 

To break the control of the program

                                                                                                                                   

 

 

 

To stop the loop execution of a program

To break the particular code execution

 

To jump out of the loop

 

Question No: 31

 

 

Constructor method will be created--

 

 

While compiling

 

While executing

 

When object is created

 

When class is created

 

Question No: 32

 

 

Expansion of DNS is--

 

 

Distributed Name Service Domain Name System Domain Name Service Domain Navigation Service

 

Question No: 33

 

 

What do you mean by abstract class?

 

 

The class, which cannot have its sub classes

 

A general class with name abstract

 

The class cannot have its own instances of objects

 

The classes used for implementations are called as abstract

 

Question No: 34

 

This is the java syntax to declare a subclass--

 

 

Class subclass: public super class

 

Subclass extends super class

 

Class subclass inherits super class

 

Class subclass extends super class

 

Question No: 35

 

 

What tags are  mandatory in HTML to display an applet?

 

 

 

 

 

Name, Height, Width Codebase, Height, Width Code, height, Width

Code

 

Question No: 36

 

 

What do you mean by final method in Java?

 

 

 

 

 

Name of the method defined

 

Name of the class, of which this method is declared

 

This is one, which cannot be overridden by ant subclasses

 

This is the Java syntax to declare a subclass

 

Question No: 37

 

 

The type of Java programs are--

 

 

 

 

 

Applications                                                                                                                                                                                                                                                                                          

Applets Servlets Packages

 

Question No: 38

 

 

What do you mean by ‘literal’ in Java?

 

 

It is a keyword in Java

 

All Java variables are called as literals

 

It is a value assigned to primitive or abstract data type variables

 

Literal is an object that exists and executed on the local machine

 

Question No: 39

 

 

What do you mean by ‘literal’ in Java?

 

 

It is a keyword in Java

 

All Java variables are called as literals

 

It is a value assigned to primitive or abstract data type variables

 

Literal is an object that exists and executed on the local machine

 

Question No: 40

 

Differentiation between component and container classes in Java is--

 

 

 

ontainer is the super class of the components

 

 

Components are the super class of the containers

                                                                                                                                             

here is no difference at all

 

 

 

 

 

University:  AMITY Year:  2015
Subject: 
Java programming
Course: 
MCA