CS 203 Exam One Answers
If you want your condition to depend upon two conditions BOTH being true, what is the proper notation to put between the two Boolean statements?
&&
Which statement is NOT true about the Classes?
All classes must include a main() method
What is the result of the following code? int num = 6.45;
Error
Class is the base class (super class) of all classes in java.
False
In Java, we can compare int variable with a boolean variable.
False
In Java, you declare the type of a variable in your code, and you can change the typeof the variable later on.
False
Java is short for "JavaScript"
False
Mutator methods don't change the data of the object
False
String is a mutable class
False
The value of a string variable can be surrounded by single quotes.
False
We can only construct one object per class
False
Which of the following statement is TRUE about JAVA exceptions?
Finally block always executes
Which of the following statement is NOT true?
In order to reduce the dependency, we should decrease the number of attributes.
Constructors are used to ________________
Initialize a newly created object
Which of the following statement is NOT true about JAVA?
It is an interpreted language.
__________ is used to run the byte code on each platform
Java Virtual Machine
Which statement is NOT true about local variables?
Local variables can be used in any other method
Which of the following is not an exception type?
Memory
What is the correct way to create an object called myObj of MyClass?
MyClass myObj = new MyClass();
two or more methods with the same name in the same class with different arguments is called as _______________.
Overloading
Which of the following statements is NOT true?
References are mutable
Which of the following statement is NOT true about JAVA object?
The object can have only one type of data
Which of the following statements is NOT true about JAVA?
The white spaces and the indentation is important
A static variable belongs to the class, not any object of the class
True
Accessor method does not change the internal data of the object on which it is invoked.
True
An immutable class has no mutator methods
True
Do - while loop is guaranteed to run at least one time
True
Every variable in Java needs a data type
True
There is no need to create the object to call the static methods.
True
Whenever we create a method, it should be either an accuser or mutator method, not both.
True
Which of the following is true about the public access modifier?
Variables, methods and constructors which are declared public can be accessed by any class.
Which of the following statements is NOT true
We should place code for producing output/consuming input inside the constructor method
Which of the following statement is True?
You must initialize the local variables
To declare an array in Java, define the variable type with:
[ ]
Which statement is used to stop a loop?
break
Which keyword is used to create a class in JAVA?
class
Abstraction hides _____________?
complexity
Within Java, you need to code your program so that under certain conditions it will skip the current iteration of a for loop. What can be used to accomplish this?
continue
Java uses ______________ for much of its error handling.
exceptions
How do you create a variable with the numeric value 5?
int x = 5;
When the child class declares a method that has the same type arguments as a method declared by its parent class is called as ________.
overriding
A ______________ of a method is any externally observable data modification (state change)
side effect
Which data structure is used to store the values of functions calls? (Hints: multiple function calls.... function calls another function and it calls another function......)
stack
____________ is a keyword which is used to access the methods or member variables of the parent class.
super
________________ refers to the object a method is being called on
this