What is OOPs? What is the Difference Between Procedural and OOPs? |
|
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 is OOPs? What is the difference between Procedural and OOPs?
2. A) Explain Inheritance, Polymorphism and Encapsulation?
B) What do you mean by Final, finalize () and finally. Explain with examples?
3. A) What are Checked and Unchecked Exception?
B) What is the difference between declaring a variable and defining a variable?
4. A) What is method overloading and overriding and State the difference between method overloading and overriding?
B) What restriction are placed on method overriding.
5. A) Does garbage collection guarantees that a program will not run out of memory?
B) Why do we need wrapper classes?
6. A) How can you achieve Multiple Inheritance in Java?
b) What is the difference between StringBuffer and String class?
7. A) What is a Java Package and how it is used?
B) Can applets communicate with each other? Explain?
8. What is the basic difference between the 2 approaches to exception handling.
1> try catch block and
2> specifying the candidate exceptions in the throws clause?
When should you use which approach?
ASSINGNMENT B
1. Write a program using inheritance to create a class Room. The class should have parameters length and breadth. Further using method overloading create another room that takes x and y as arguments. Create a function to Area () to calculate area of room (length*breadth). Derive a class from Room called Room1. It has a 1 parameter height. Using method overloading create another room1 that takes x, y and z as arguments. Create a function Volume to calculate volume of room (length*breadth*height).
Assignment C
Question No. 1
What would be the results of compiling and running the following class. Select the one correct answer.
class test
{
public static void main()
{
System.out.println("test");
}
}
Options
The program does not compile as there is no main method defined
The program compiles and runs generating an output of "test"
The program compiles and runs but does not generate any output
The program compiles but does not run.
Question No. 2
Which of these are valid declarations for the main method? Select the one correct answer.
Options
public void main();
public static void main(String args[]);
static public void main(String);
public static void main(String );
Question No. 3
Which of the following are valid declarations for the main method. Select the three correct answers
Options
public static void main(String args[]);
public static void main(String []args);
final static public void main (String args[]);
public static int main(String args[]);
Question No. 4
What happens when the following program is compiled and executed with the command - java
test. Select the one correct answer.
class test {
public static void main(String args[])
{ if(args.length > 0)
System.out.println(args.length);
} }
Options
The program compiles and runs but does not print anything.
The program compiles and runs and prints 0
The program compiles and runs and prints 1
The program compiles and runs and prints 2
Question No. 5
The signed right shift operator in Java is --. Select the one correct answer
Options
<<;
>>
>>>;
None of these.
Question No. 6
What gets printed on the standard output when the class below is compiled and executed. Select the one correct answer.
public class ShortCkt {
public static void main(String args[])
{ int i = 0; boolean
t = true;
boolean f = false, b;
b = (t && ((i++) == 0));
b = (f && ((i+=2) > 0));
System.out.println(i); } }
Options
0
1
2
3
Question No. 7
What gets printed on the standard output when the class below is compiled and executed. Select the one correct answer.
public class ShortCkt {
public static void main(String args[]) {
int i = 0; boolean
t = true;
boolean f = false, b;
b = (t || ((i++) == 0));
b = (f || ((i+=2) > 0));
System.out.println(i); } }
Options
0
1
2
3
Question No. 8
What gets printed on the standard output when the class below is compiled and executed. Select the
One correct answer. public class ShortCkt { public static void main(String args[]) { int i = 0;
boolean t = true; boolean f = false, b; b = (t | ((i++) == 0)); b = (f | ((i+=2) > 0));
System.out.println(i); } }
Options
0
1
2
3
Question No. 9
Which operator is used to perform bitwise inversion in Java. Select the one correct answer.
Options
~
!
&
|
Question No. 10
A function is:
Options
An entity that receives inputs and outputs
A way of storing values
A sequence of characters enclosed by quotes
A kind of computer
Question No. 11
The method setLabel can be used with what type of Object?
Options
DoubleField
int
TextField
String
Question No. 12
What is the difference between a TextArea and a TextField?
Options
A TextArea can handle multiple lines of text
A textarea can be used for output
TextArea is not a class
TextAreas are used for displaying graphics
Question No. 13
How many types of comments are possible in java?
Options
Two
Three
One
None of these
Question No. 14
Which of the following are valid variable names?
Options
Catch
Nocount
Msisdn
Switch
Question No. 15
A variable name:
Options
Must not be a keyword in java.
Must not being with a digit.
Must not contain embedded space.
Can contain characters from various alphabets, like Japanese, Greek & Cyrillic.
Question No. 16
Java program are:-
Options
Platform dependent.
Platform Independent.
Portable
Robust
Question No. 17
The---------operator is used to create a class object.
Options
Create
Dot
New
None of these
Question No. 18
Which loop is called entry controlled loop
Options
For loop
While loop
Do-while loop
Repeat until loop
Question No. 19
Which of the following are comparison operators?
Options
= =
!
|
!=
Question No. 20
Switch (Expression) {
Case value 1:
// Statement Sequence
Break;
Case value 2:
// Statement Sequence
Break;
-
-
Default:
}
The expression must be of type—
Options
Short
Int
Byte
Char
Question No. 21
How do you declare an array?
Options
Int []num;
Int num[];
Int num[]=new int[10];
All of the above
Question No. 22
A constructor has
Options
Same names as that of the class
Does not have a return type
Can be called automatically when the object of a class is created
All of the above
Question No. 23
The keyword super is used for calling
Options
Derived class constructor
Base class constructor
Initializing the variable of a base class
All of the above
Question No. 24
A constructor without any arguments/parameters is known as---------
Options
Copy constructor
Parameterized constructor
Default constructor
None of these
Question No. 25
A class declared as final cannot be
Options
Inherited
Overloaded
Overridden
All of the above
Question No. 26
Java handles exceptions the--------way
Options
Procedural oriented
Natural
Object oriented
None of the these
Question No. 27
Which two classes are derived from Throwable Class?
Options
Error & Exception
Throw & Throws
Try & Finally
None of these
Question No. 28
In order to handle user defined exception which keyword is used
Options
Throw
Throws
Throwable
Finally
Question No. 29
Java applications are run by using a
Options
Java compiler
Java interpreter
Javac
None of these
Question No. 30
Which of the following are primitive data types?
Options
Int
Char
Byte
String
Question No. 31
Which of the following methods are present in applet life cycle?
Options
Main()
Paint()
Init()
Start()
Question No. 32
AWT stands for
Options
Abstract Window Toolkit
Abstract Window Toolpane
Applet Window Toolkit
Asynchronous Windowing Tool
Question No. 33
What are the components of an event?
Options
Event handler
Event object
Event source
None of these
Question No. 34
If no access specifier is specified before a class name or variable name or function name then which is the defaults specifier-----
Options
Public
Private
Protected
Default
Question No. 35
What is the size of the integer & character types in java?
Options
4 bytes & 2 bytes
2 bytes & 1 bytes
2 bytes & 2 bytes
4 bytes & 1 bytes
Question No. 36
If we write final keyword infront of a function name then the function cannot be
Options
Overloaded
Overridden
Inherited
Abstract
Question No. 37
Two function are said to be overloaded if ---
Options
It has the same name
The return type many or may not be same
Argument list must differ
None of these
Question No. 38
Which tool creates the C-header file
Options
Javac
Java
Javah
Jdb
Question No. 39 Solve by www.solvezone.in
CLASSPATH is ----
Options
A keyword
A variable name
An environmental variable
None of these
Question No. 40
What is the difference between Switch & Statement & if –else
Options
There is no difference
Switch statement is used for checking all condition(i.e. equal to ,>&<) where as
Switch statement only checks for equality condition where as if else is used for checking all type of condition.
None of these