Computer Science Test Questions and Answers
/* - ANSWER-This marks the beginning of a multiline comment.
/n - ANSWER-Which of the following is an example of an escape sequence?
/n
while
main
Scanner
= is a Simple assignment operator while == is Equal to. - ANSWER-Explain how = is
different than ==.
1 less than the number of elements - ANSWER-The last subscript in an array list is
always what?
19 - ANSWER-How many times will the body of the loop execute?
for (int i = 1; i < 20, i++)
{
System.out.println ( i )
}
2D Array - ANSWER-If you have data that can be visualized in a table with rows and
columns, you should use a _______.
9 - ANSWER-How many times will the body of the loop execute?
for (int i = 1; i < 10, i++)
{
System.out.println ( i )
}
A declaration opens up a space for a value in the computer's memory and an
assignment fills it with a value.
Declaration: Int Example;
Assignment: Example = #; - ANSWER-What is the difference between a declaration and
an assignment? Give examples.
Accessor, Mutator - ANSWER-A no-arg constructor is usually accompanied by a
_______, _______ method(s)).
Accumulating - ANSWER-This term us used to describe variables that keep a running
total of something.
all of the above (dependent on type) - ANSWER-Default constructors set all object's
variables to _____.
o
, o.o
null
all of the above (dependent on type)
An object is created with a constructor to perform certain tasks or hold data while a field
is the data a object holds. - ANSWER-What is the difference between an object and a
field.
Argument - ANSWER-A(n) ________ is a value that is passed into a method.
Binding - ANSWER-When you have more than one method or variable with the same
name, you can solve it with ____.
Constructor - ANSWER-A bit of code that allows you to create objects from a class.
count == 1 - ANSWER-Which of the following does not change the value of a variable?
count++
count == 1
count += 1
count = 1
count = count + 1
Default Constructors are provided by Java and sets all object's variables to the default
value. A no-arg constructor is made by the programmer and does not take in all
arguments. - ANSWER-Difference between a default Constructor and a no-arg
Constructor.
Event Listener - ANSWER-Graphical components like a JButton or JTextField are
examples of a(n) _______.
Extends - ANSWER-______ is used in a class definition when establishing an is-a
relationship.
Field - ANSWER-A class, interface or enum associated with a value are examples of a
_____.
Final - ANSWER-This is a keyword used when declaring a variable which cannot be
changed.
Free - ANSWER-Free Question Type "Free"!
Inheritance - ANSWER-What combines a Subclass with a superclass.
JFrame - ANSWER-A top-level window with a title and a border. The size includes any
area designated for the border.
/* - ANSWER-This marks the beginning of a multiline comment.
/n - ANSWER-Which of the following is an example of an escape sequence?
/n
while
main
Scanner
= is a Simple assignment operator while == is Equal to. - ANSWER-Explain how = is
different than ==.
1 less than the number of elements - ANSWER-The last subscript in an array list is
always what?
19 - ANSWER-How many times will the body of the loop execute?
for (int i = 1; i < 20, i++)
{
System.out.println ( i )
}
2D Array - ANSWER-If you have data that can be visualized in a table with rows and
columns, you should use a _______.
9 - ANSWER-How many times will the body of the loop execute?
for (int i = 1; i < 10, i++)
{
System.out.println ( i )
}
A declaration opens up a space for a value in the computer's memory and an
assignment fills it with a value.
Declaration: Int Example;
Assignment: Example = #; - ANSWER-What is the difference between a declaration and
an assignment? Give examples.
Accessor, Mutator - ANSWER-A no-arg constructor is usually accompanied by a
_______, _______ method(s)).
Accumulating - ANSWER-This term us used to describe variables that keep a running
total of something.
all of the above (dependent on type) - ANSWER-Default constructors set all object's
variables to _____.
o
, o.o
null
all of the above (dependent on type)
An object is created with a constructor to perform certain tasks or hold data while a field
is the data a object holds. - ANSWER-What is the difference between an object and a
field.
Argument - ANSWER-A(n) ________ is a value that is passed into a method.
Binding - ANSWER-When you have more than one method or variable with the same
name, you can solve it with ____.
Constructor - ANSWER-A bit of code that allows you to create objects from a class.
count == 1 - ANSWER-Which of the following does not change the value of a variable?
count++
count == 1
count += 1
count = 1
count = count + 1
Default Constructors are provided by Java and sets all object's variables to the default
value. A no-arg constructor is made by the programmer and does not take in all
arguments. - ANSWER-Difference between a default Constructor and a no-arg
Constructor.
Event Listener - ANSWER-Graphical components like a JButton or JTextField are
examples of a(n) _______.
Extends - ANSWER-______ is used in a class definition when establishing an is-a
relationship.
Field - ANSWER-A class, interface or enum associated with a value are examples of a
_____.
Final - ANSWER-This is a keyword used when declaring a variable which cannot be
changed.
Free - ANSWER-Free Question Type "Free"!
Inheritance - ANSWER-What combines a Subclass with a superclass.
JFrame - ANSWER-A top-level window with a title and a border. The size includes any
area designated for the border.