What are the Most Important Features of Java? How does Java Achieve platform Independence? |
|
University | Amity blog |
Service Type | Assignment |
Course | |
Semester | |
Short Name or Subject Code | Java Programming |
Product | of Assignment (Amity blog) |
Pattern | Section A,B,C Wise |
Price | Click to view price |
Java Programming
Assignment A
1. What are the most important features of Java? How does Java achieve platform independence?
2. a) What are native methods? How do you use them?
b) What are wrapper classes? Why are they used?
3. Explain the concept of method overriding. Can we over-ride method within the same class? Explain.
4. What is a static method? Why can’t a static method use ‘this’ and ‘super’? Explain with example.
5. a) State the significance of public, private, protected, default modifiers
b) What are different types of inner classes?
6. a) How does exception-handling work in Java?
b) Why Java doesn't support multiple inheritances?
7. Explain the concept of interface. What is scope and nature of variables and methods defined in an interface?
8. Explain the event delegation models in AWT. What are the components of an event?
Assignment B
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.
3. Create the following form in Java:-
a) . Subject should display name of subjects: -
C++
VB
Java
b). Foreign language should display choice of foreign languages French, German and Japanese.
c). 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;
Options
(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;
Options
(A) & (C)
(A)
(A), (C) & (D)
(A), (B) & (D)
Question No. 3
The control expression in an "if" statement must be--
Options
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();
Options
(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
Options
Class header definition is wrong
Method definition is wrong
Constructor needs to be defined
No errors
Question No. 6
With javadoc, which of the following denotes a javadoc comment?
Options
/**
//#
/*
//**
Question No. 7
Which javadoc tag is used to denote a comment for a method parameter?
Options
@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?
Options
1.66
1
None of these
4
Question No. 9
Determine the output when the value of x is zero--
if(x >= 0)
if(x > 0)
System.out.println("x is positive");
else
System.out.println("x is negative");
Options
"x is negative"
"x is positive"
"x is positive" and "x is negative"
None of these
Question No. 10
Which of the following is correct syntax for an Abstract class?
Options
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″);
}
Options
No output
3 & 5
1, 3 & 5
3
Question No. 12
__________ converts the java program to byte code.
Options
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?
Options
No error
Compile error
Runtime Error
No error but goes to infinite loop
Question No. 14
JVM stands for
Options
Java Vision Mechanism
Java Virtual Machine
Java Virtual Model
Java Vertical Model
Question No. 15
Java consists of a ready-made package called
Options
Java Program
Java Applet
Java API
Java Widgets
Question No. 16
Java Platforms consists of --
Options
Java Program and Applet
Java API and JVM
Java Widgets and Program
Java Virtual Machine and Applets
Question No. 17
Which of the following are not logical operators?
Options
>>
&&
!
^
Question No. 18
Java was developed by--
Options
Microsoft
Sun Microsystems
Borland
Siemens
Question No. 19
Which of the following variable is valid in Java?
Options
variable1
variable2_n
variable=
variable 4
Question No. 20
What is the result of the following operation?
System.out.println (4 / 3)
Options
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}
Options
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.
Options
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.
Options
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--
Options
Inheritance
Method overloading
Method overriding
Polymorphism
Question No. 25
The keyword ‘new’ will--
Options
Create an instance of a object
Create the instance of a class
Assigns 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
Options
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--
Options
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 --
Options
Adjustment Listener
Item Listener
Action Listener
Text Listener
Question No. 29
Signature of the method includes--
Options
Name of the Method
List of parameters
Return type of the method
Only a) and b)
Question No. 30
Break statement is used for--
Options
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--
Options
While compiling
While executing
When object is created
When class is created
Question No. 32
Expansion of DNS is--
Options
Distributed Name Service
Domain Name System
Domain Name Service
Domain Navigation Service
Question No. 33
What do you mean by abstract class?
Options
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--
Options
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?
Options
Name, Height, Width
Codebase, Height, Width
Code, height, Width
Code
Question No. 36
What do you mean by ‘literal’ in Java?
Options
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. 37
What do you mean by ‘literal’ in Java?
Options
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. 38
Differentiation between component and container classes in Java is--
Options
Container is the super class of the components
Components are the super class of the containers
Component can hold only one object, whereas container can have single or collection of objects
There is no difference at all
Question No. 39
What do you mean by final method in Java?
Options
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. 40
The type of Java programs are--
Options
Applications
Applets
Servlets
Packages