Vous êtes sur la page 1sur 3

Kuvempu University

Assignment for B.Sc.(IT) Course

Subject: JAVA Programming


Subject Code: BSIT - 42

Assignment: TA (Compulsory)

1. The name of a Java program file must match the name of the class with the
extension .java
A. True
B. False
2. Two methods cannot have the same name in Java.
True
A. False
3. The modulus operator (%) can be used only with integer operands
A. True
B. False
4. Declarations can appear anywhere in the body of a Java method.
A. True
B. False
5. All the bitwise operators have the same level of precedence in Java.
A. True
B. False
6. When X is a positive number, the operations x>>2 and x>>>2 both produce the
same result.
A. True
B. False
7. If a=10 and b=15, then the statement x=(a>b)?a:b; assigns the value 15 to x
A. True
B. False
8. In evaluating a logical expression of type
Boolean expression1 && Boolean expression2
Both the Boolean expressions are not always evaluated.
A. True
B. False
9. In evaluating the expression (x == y && a<b) the boolean expression x==y is
evaluated first and then a<b is evaluated.
A. True
B. False
10. The default base is always required in the switch selection structure.
A. True
B. False
11. The break statement is required in the default case of a switch selection
structure.
A. True
B. False
12. The expression (x ==y && a<b) is true if either x == y is true or a<b is true
A. True
B. False
13. A variable declared inside the for loop control cannot be referenced outside the
loop
A. True
B. False
14. Java always provides a default constructor to a class
A. True
B. False
15. When present package must be the first noncomment statement in the file.
A. True
B. False
16. The import statement is always the first noncomment statement in a Java
program file
A. True
B. False
17. Objects are passed to a method by use of call-by-reference
A. True
B. False
18. It is perfectly legal to refer to any instance variable inside of a static method.
A. True
B. False
19. When we implement an interface method, it should be declared as public
A. True
B. False
20. We can overload methods with differences only in their return type
A. True
B. False
21. It is an error to have a method with the same signature in both the super class
and its subclass.
A. True
B. False
22. A constructor must always invoke its super class constructor in its first
statement.
A. True
B. False
23. Subclasses of an abstract class that do not provide an implementation of an
abstract method, are also abstract.
A. True
B. False
24. Any class may be inherited by another class in the same package.
A. True
B. False
25. Any method in a super class can be overridden in its subclass.
A. True
B. False

Assignment: TB (Compulsory)

1) Compare class variables and instance variables.


2) What are objects ? How are they created from a class ?
3) How is a method defined ?
4) What are constructors ? What are its special properties ?
5) With the help of an example program explain method overloading in Java.
6) With the help of an example program explain the inheritance concept in Java.
7) What do you mean by method overriding ?
8) What do you mean by arrays ? Explain how to create and initialize arrays in Java.
9) Explain the different access modifiers in Java
10) With an example explain the different string methods in java.
11) What do you mean by multithreaded program ? Explain the life cycle of a thread .
12) Explain the different methods of creating a thread.
13) What is a package ? Write a procedure to create your own package.
14) What do mean by interface ? Explain with an example.
15) What do you mean by exception ? Explain how it is handled in Java.
16) Explain different stream classes in Java.

Vous aimerez peut-être aussi