CSCI 2010 MIDTERM
Operator - ANS-a way to access a category-exempt example variable A variable declared in
one method will have the same name as a variable declared in any other approach -
ANS-authentic
A return statement of kind ANS-real may be found in a void approach. Get admission to
modifiers: public, protected, personal, and ANS-default An array must incorporate most effective
objects of the same type, ANS-actual. ANS-authentic, an array can be used as a class example
variable. The ANS-fake Java Math class can simplest be used with an import assertion.
Assertion - ANS-declaration that announces something about the state of your application
statement take a look at - ANS-verifies whether an announcement is real
The Java VM option -ea or -enableassertions - ANS-real can be used to enable declaration
tests, which might be disabled by means of default. - ANS-Trombone[] marchingBand = new
Trombone[101]; Assume there is a class referred to as Trombone with a default constructor.
Which of the following is the appropriate manner to create and initialize an array of 76
Trombone objects? For (int i=0, i++, and imarchingBand.Period) marchingBand[i] is same to
new Trombone(); The ANS-real Boolean kind isn't always a numerical kind. An mistakes
message of ANS-True may be displayed when a technique is called on a variable with a null
price. The character's unicode value may be the casting kind char - ANS-result. Magnificence
interface - ANS-headers of public strategies and any public named constants
magnificence loader: ANS loads and connects all the vital elegance documents. Correct
implementation of the addItem approach? - ANS-public boolean addItem (String object)
if (numberItems length of list) False return; else
object = list[numItems] numberItems ++; return proper;
Encapsulation, or ANS, is the practice of grouping specifics (which include statistics and tactics)
into a single section of a program in order that other programmers working at the application do
not have to understand approximately them. Enumeration - ANS-finite set of named constants
ANS-for (int i=zero; ipeople.Period; i++): Given a Person elegance with a public void technique
known as display that takes no arguments, which of the following is the right manner to call
display on all of the elements of an array of humans gadgets? Human beings[i].Display();
given a two-dimensional array referred to as desk, which of the subsequent will efficaciously
display all of the entries within the desk? - ANS-for (int row = 0; row < desk.Length; row++)
for (int col = 0; col < desk[row].Period; col++)
System.Out.Println(table[row][column];
Given the code:
String greeting = "Hello there!" ;
System.Out.Println(greeting.Length());
What is displayed to the screen? - ANS-12
Given the subsequent constructors :
public Rectangle (int width, double period)
public Rectangle (int period, double width) which constructor will the subsequent
announcement name?
, An blunders will occur while rectangle rect = new rectangle (four,6) in ANS-Java. Given the for
loop that follows: for (be counted = 0, count less than 4, and depend++)
System.Out.Println(count number);
Which of the following is an equivalent even as loop? - ANS-remember = zero;
even as counting to four count++;
given the following initial array :
'P', 'A', 'U', 'S'
which of the subsequent effectively illustrates the sequence of passes performed by means of
selection sort? - ANS- P A U S
APUS
APUS
APSU
Given two arrays array1 and array2, while does the expression array1 == array2 examine to
true? - ANS-when array1 and array2 talk over with the identical array object
How are variables of a primitive kind distinct from variables of a class kind? - ANS-The
reminiscence location of a variable of a primitive type includes a statistics fee itself
the memory vicinity of a variable of a category kind contains a connection with an object
If an array index is much less than zero or greater than or equal to the period, Java will
generate an blunders all through runtime - ANS-authentic
if an array is looked after the quickest manner to look it's far with the aid of the usage of a
sequential search - ANS-false
If an array is used as a parameter in a technique, the duration of the array have to be supplied -
ANS-False
Java will robotically outline ANS-actual because the default constructor for a class if no
constructors are defined. If you assemble a java source record containing a definition of class
referred to as MyApp, what is the call of the report that includes the outcomes -
ANS-MyApp.Class
implementation - ANS-instance variables and approach definitions in the class
In Java, arrays can have greater than measurement - ANS-genuine
statistics hiding - ANS-programmer the use of a way needs to know what the method does,
now not how it does it
Inheritance - ANS-a way of organizing lessons into a category hierarchy
Java has unsigned integer kinds - ANS-fake
Java is portable - ANS-any laptop with the JVM mounted can run Java bytecode
method definitions can be marked as private? (T/F) - ANS-true
a couple of constructors may be defined as long as they have got a distinctive variety of
parameters or have parameters with different types - ANS-true
polymorphism - ANS-lets in the program practise to intend different things in one-of-a-kind
contexts
publish condition - ANS-remark describes all the consequences produced by means of a way
call
The preconditions that must be met earlier than the method is known as are stated in ANS. A
constructor won't be overloaded, however regular strategies can also; ANS-False Scanner
Class - ANS-need to be imported from java.Util
Operator - ANS-a way to access a category-exempt example variable A variable declared in
one method will have the same name as a variable declared in any other approach -
ANS-authentic
A return statement of kind ANS-real may be found in a void approach. Get admission to
modifiers: public, protected, personal, and ANS-default An array must incorporate most effective
objects of the same type, ANS-actual. ANS-authentic, an array can be used as a class example
variable. The ANS-fake Java Math class can simplest be used with an import assertion.
Assertion - ANS-declaration that announces something about the state of your application
statement take a look at - ANS-verifies whether an announcement is real
The Java VM option -ea or -enableassertions - ANS-real can be used to enable declaration
tests, which might be disabled by means of default. - ANS-Trombone[] marchingBand = new
Trombone[101]; Assume there is a class referred to as Trombone with a default constructor.
Which of the following is the appropriate manner to create and initialize an array of 76
Trombone objects? For (int i=0, i++, and imarchingBand.Period) marchingBand[i] is same to
new Trombone(); The ANS-real Boolean kind isn't always a numerical kind. An mistakes
message of ANS-True may be displayed when a technique is called on a variable with a null
price. The character's unicode value may be the casting kind char - ANS-result. Magnificence
interface - ANS-headers of public strategies and any public named constants
magnificence loader: ANS loads and connects all the vital elegance documents. Correct
implementation of the addItem approach? - ANS-public boolean addItem (String object)
if (numberItems length of list) False return; else
object = list[numItems] numberItems ++; return proper;
Encapsulation, or ANS, is the practice of grouping specifics (which include statistics and tactics)
into a single section of a program in order that other programmers working at the application do
not have to understand approximately them. Enumeration - ANS-finite set of named constants
ANS-for (int i=zero; ipeople.Period; i++): Given a Person elegance with a public void technique
known as display that takes no arguments, which of the following is the right manner to call
display on all of the elements of an array of humans gadgets? Human beings[i].Display();
given a two-dimensional array referred to as desk, which of the subsequent will efficaciously
display all of the entries within the desk? - ANS-for (int row = 0; row < desk.Length; row++)
for (int col = 0; col < desk[row].Period; col++)
System.Out.Println(table[row][column];
Given the code:
String greeting = "Hello there!" ;
System.Out.Println(greeting.Length());
What is displayed to the screen? - ANS-12
Given the subsequent constructors :
public Rectangle (int width, double period)
public Rectangle (int period, double width) which constructor will the subsequent
announcement name?
, An blunders will occur while rectangle rect = new rectangle (four,6) in ANS-Java. Given the for
loop that follows: for (be counted = 0, count less than 4, and depend++)
System.Out.Println(count number);
Which of the following is an equivalent even as loop? - ANS-remember = zero;
even as counting to four count++;
given the following initial array :
'P', 'A', 'U', 'S'
which of the subsequent effectively illustrates the sequence of passes performed by means of
selection sort? - ANS- P A U S
APUS
APUS
APSU
Given two arrays array1 and array2, while does the expression array1 == array2 examine to
true? - ANS-when array1 and array2 talk over with the identical array object
How are variables of a primitive kind distinct from variables of a class kind? - ANS-The
reminiscence location of a variable of a primitive type includes a statistics fee itself
the memory vicinity of a variable of a category kind contains a connection with an object
If an array index is much less than zero or greater than or equal to the period, Java will
generate an blunders all through runtime - ANS-authentic
if an array is looked after the quickest manner to look it's far with the aid of the usage of a
sequential search - ANS-false
If an array is used as a parameter in a technique, the duration of the array have to be supplied -
ANS-False
Java will robotically outline ANS-actual because the default constructor for a class if no
constructors are defined. If you assemble a java source record containing a definition of class
referred to as MyApp, what is the call of the report that includes the outcomes -
ANS-MyApp.Class
implementation - ANS-instance variables and approach definitions in the class
In Java, arrays can have greater than measurement - ANS-genuine
statistics hiding - ANS-programmer the use of a way needs to know what the method does,
now not how it does it
Inheritance - ANS-a way of organizing lessons into a category hierarchy
Java has unsigned integer kinds - ANS-fake
Java is portable - ANS-any laptop with the JVM mounted can run Java bytecode
method definitions can be marked as private? (T/F) - ANS-true
a couple of constructors may be defined as long as they have got a distinctive variety of
parameters or have parameters with different types - ANS-true
polymorphism - ANS-lets in the program practise to intend different things in one-of-a-kind
contexts
publish condition - ANS-remark describes all the consequences produced by means of a way
call
The preconditions that must be met earlier than the method is known as are stated in ANS. A
constructor won't be overloaded, however regular strategies can also; ANS-False Scanner
Class - ANS-need to be imported from java.Util