Java/ C++ Interview Questions - ABACUS

1. A class named Test class does not have an overloaded assignment operator. Out of the below given options, which one is correct when an assignment a=b; is given for two Test objects a and b?

a) The automatic assignment operator is used
b) The copy constructor is used
c) Compiler error
d) Run-time error

2. Peer-to-peer relationship is a type of _________.

a) Link
b) Aggregation
c) Association
d) None of above

3. What is the correct syntax to instantiate MyName?

public class MyName{
public MyName(){/*code*/}
// your code...
}

a) MyName mc = new MyName ();
b) MyName mc = MyName ();
c) MyName mc = My MyName;
d) MyName mc = new MyName;
e) None of the above

4. Choose the correct definition of byte code in Java?

a) code generated by a Java compiler
b) code generated by a Java Virtual Machine
c) It is another name for a Java source file
d) It is the code written within the instance methods of a class.
e) It is another name for comments written within a program.

5. What can be predicted by seeing the program when compiled and executed?

submarine.dive(depth);

a) depth must be an int
b) dive must be a method.
c) dive must be the name of an instance field.
d) submarine must be the name of a class
e) submarine must be a method.


6. What is a class?
a) Data Type
b) Abstract Type
c) User Defined Type
d) All of these options

Post your comment