Literally Exam 1

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which statement is not True about the Classes?

All classes must include a main() method

The value of a string variable can be surrounded by single quotes

False

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 bytecode on each platform.

Java Virtual Machine (JVM)

What is the result of the following code? int num = 6.45;

Error

Java uses _______________ for much of its error handling

Exceptions

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 type of that variable later on.

False

Mutator methods don't change the data of the object

False

String is a mutable class

False

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? Error Memory Checked Runtime

Memory

What is the correct way to create an object called myObj of MyClass?

MyClass myObj = new MyClass();

Inheritance

The process by which a new Class is created from another Class

Whenever we create a method, it should be either an accessor 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 lying in same package Variables, methods and constructors which are declared public can be accessed by only the accessor methods of that class Variables, methods and constructors which are declared public can be accessed by any class Variables, methods and constructors which are declared public in the superclass can be accessed only by its child class

Variables, methods and constructors which are declared public can be accessed by any class

To declare an array in Java, define the variable type with:

[]

Which of the following statement is True about JAVA exceptions?

finally block always executes

The specialized Classes are said to

inherit the public methods and public and private instance variables of the general Class

A ____________ of a method is any externally observable data modification (state change)

side effect

_______ 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

Abstraction hides __________?

complexity

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?

&&

A derived Class automatically has all the

instance variables and public methods that the base Class has, and it can have additional methods and/or instance variables as well

How do you create a variable with the numeric value 5?

int x=5;

Why is inheritance advantageous?

it allows Classes to be Reused, without having to copy it into the definitions { } of the derived Classes

We can only construct one object per class

False

Which keyword is used to create a class in Java?

class

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

Which of the following statement 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

Which of the following statement is not True? A class depends on another class if its methods use that class in any way We should place code for producing output/consuming input inside the constructor method Always strive to decouple input and output from classes' work We should reduce the dependency as much as possible

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 Local variables belongs to the class Instance variables belongs to method Object references are set to zero

You must initialize the local variables

Which statement is used to stop a loop?

break

REVIEW SLIDE 7-14

REVIEW SLIDE 7-14

There is no need to create the object to call the static methods.

True

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

Which of the following statement is not True? In order to reduce the dependency, we should decrease the number of attributes We should minimize the dependency as much as possible Abstraction is a technique for structuring computer programs Abstraction reduces things down to the simplest components possible

Answer: In order to reduce the dependency, we should decrease the number of attributes

Java is short for "JavaScript".

False

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? There can be multiple variables referencing same object A reference is the location in memory that an object resides References are mutable The value of an object variable is a reference

References are mutable

Which of the following statement is not True about JAVA object?

The object can have only one type of data

An immutable class has no mutator methods

True

Do - while loop is guaranteed to run at least one time

True

Every variable in JAVA need a data type

True

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


Conjuntos de estudio relacionados

unit 2 - pituitary adenoma case study quiz

View Set

Practice Exam 2- Human Sexuality

View Set

Chapter 8: Internal Control and Cash

View Set

Angina, MI, Aneurysms Questions (NCLEX)

View Set

A difficulty in visual tracking & attention is the definition of which of the following defects associated with posterior parietal cortex lesions?

View Set

Energy, Work and Simple Machines, Simple & Compound Machines, Examples of Simple Machines

View Set