CSCI 1010 - Quiz 1 - 12 & Midterm
(2 + five) / 2 - ANS-3
(double)(thirteen / 2) - ANS-6.Zero
13 % four - ANS-1
3 + - ANS-4
.Zero + 2.3 - ANS-five.Eight
a = 10;
b = 3;
if (a > 5)
c = b;
System.Out.Print(a);
System.Out.Print(c);
else
c = 10;
System.Out.Print(a);
System.Out.Print(c);
System.Out.Print(a);
- ANS-103103 System.Out.Print(b); a = 2; b = 6;
a += b;
System.Out.Print(a);
System.Out.Println(b);
a = 6;
b++;
System.Out.Print(a);
System.Out.Println(b); - ANS-86
sixty seven
A boolean variable can not be used the controlling boolean expression in a loop. - ANS-False
A damage declaration can be used interior a transfer declaration, however not inner a loop. -
ANS-False
A magnificence known as Printer has a way known as printDocument. This calls a void
approach inside the Printer class referred to as printPage that takes an integer representing the
web page number as a controversy. With a four argument, how have to printDocument be
called printPage? - ANS-printPage(4); A do-while loop continually executes the statements in its
frame at the least as soon as. - ANS-True
A hardware device that executes the commands in a software. - ANS-CPU
A hardware device that stores data for the computer to procedure. - ANS-Memory
A loop might terminate for a few enter data values, however repeat infinitely for other values. -
ANS-True
, A system language for a virtual machine. - ANS-Bytecode
ANS-Expression: a aspect of a software that may be evaluated to generate a cost. A a part of a
application that may be accomplished so as to perform an action. - ANS-Statement
A software or a part of a application written in a excessive-level language. - ANS-Source Code
ANS-Algorithm is a hard and fast of instructions for fixing a computational problem. A statement
beginning a file for reading or writing may additionally generate a FileNotFoundException. -
ANS-True
A stub is a simplified version of a technique this is enough for testing functions. - ANS-True
A strive block must have a corresponding capture block. - ANS-True
A variable may be declared within the initialization a part of a for announcement. - ANS-True
A variable declared in one method could have the same call as a variable declared in every
other method. - ANS-True
ANS-True: A variable declared within a block can not be accessed from outdoor that block. A
variable this is declared inside of a way is called a ________ variable. - ANS-nearby
After executing the following statements:
int range = 7;
number * equals three; What is the cost of the variable wide variety? - ANS-21
All methods ought to go back a price - ANS-False
All of the items stored in an array should be of the same kind. - ANS-True
An array may be used as an instance variable in a class. - ANS-True
An import statement is required to use the java Math class. - ANS-False
Anything written among the symbols /* and */ is a comment and is not noted by way of the
compiler. - ANS-True
Assume there is a class referred to as leopard with a member characteristic known as
getNumberOfSpots that takes no arguments and returns an integer fee. What could be the
correct way to call that method on a Leopard item known as laura? - ANS-int numSpots =
laura.GetNumberOfSpots();
assuming the subsequent declaration is present: Scanner keyboard;
Which is the appropriate way to read a booolean value? - ANS-boolean flag =
keyboard.NextBoolean();
Calling a technique on a variable with a fee of null will result in an error message. - ANS-True
Chooses one action from a list of or greater feasible movements. - ANS-Branching Statement
Consider the subsequent code:
Employee empl = new Employee();
emp1.SetName("Anna Karenina");
Employee emp2 - new Employee();
emp2.SetName("David Copperfield");
emp2 = emp1;
Which of the following great describes the contents of the two variables emp1 and emp2 after
this code has done? - ANS-emp1 refers back to the object with the name Anna Karenina. Emp2
refers back to the same item.
Consider the following loop that provides up a sequence of numbers?
For (int matter = 1; remember <= n; remember++;)
(2 + five) / 2 - ANS-3
(double)(thirteen / 2) - ANS-6.Zero
13 % four - ANS-1
3 + - ANS-4
.Zero + 2.3 - ANS-five.Eight
a = 10;
b = 3;
if (a > 5)
c = b;
System.Out.Print(a);
System.Out.Print(c);
else
c = 10;
System.Out.Print(a);
System.Out.Print(c);
System.Out.Print(a);
- ANS-103103 System.Out.Print(b); a = 2; b = 6;
a += b;
System.Out.Print(a);
System.Out.Println(b);
a = 6;
b++;
System.Out.Print(a);
System.Out.Println(b); - ANS-86
sixty seven
A boolean variable can not be used the controlling boolean expression in a loop. - ANS-False
A damage declaration can be used interior a transfer declaration, however not inner a loop. -
ANS-False
A magnificence known as Printer has a way known as printDocument. This calls a void
approach inside the Printer class referred to as printPage that takes an integer representing the
web page number as a controversy. With a four argument, how have to printDocument be
called printPage? - ANS-printPage(4); A do-while loop continually executes the statements in its
frame at the least as soon as. - ANS-True
A hardware device that executes the commands in a software. - ANS-CPU
A hardware device that stores data for the computer to procedure. - ANS-Memory
A loop might terminate for a few enter data values, however repeat infinitely for other values. -
ANS-True
, A system language for a virtual machine. - ANS-Bytecode
ANS-Expression: a aspect of a software that may be evaluated to generate a cost. A a part of a
application that may be accomplished so as to perform an action. - ANS-Statement
A software or a part of a application written in a excessive-level language. - ANS-Source Code
ANS-Algorithm is a hard and fast of instructions for fixing a computational problem. A statement
beginning a file for reading or writing may additionally generate a FileNotFoundException. -
ANS-True
A stub is a simplified version of a technique this is enough for testing functions. - ANS-True
A strive block must have a corresponding capture block. - ANS-True
A variable may be declared within the initialization a part of a for announcement. - ANS-True
A variable declared in one method could have the same call as a variable declared in every
other method. - ANS-True
ANS-True: A variable declared within a block can not be accessed from outdoor that block. A
variable this is declared inside of a way is called a ________ variable. - ANS-nearby
After executing the following statements:
int range = 7;
number * equals three; What is the cost of the variable wide variety? - ANS-21
All methods ought to go back a price - ANS-False
All of the items stored in an array should be of the same kind. - ANS-True
An array may be used as an instance variable in a class. - ANS-True
An import statement is required to use the java Math class. - ANS-False
Anything written among the symbols /* and */ is a comment and is not noted by way of the
compiler. - ANS-True
Assume there is a class referred to as leopard with a member characteristic known as
getNumberOfSpots that takes no arguments and returns an integer fee. What could be the
correct way to call that method on a Leopard item known as laura? - ANS-int numSpots =
laura.GetNumberOfSpots();
assuming the subsequent declaration is present: Scanner keyboard;
Which is the appropriate way to read a booolean value? - ANS-boolean flag =
keyboard.NextBoolean();
Calling a technique on a variable with a fee of null will result in an error message. - ANS-True
Chooses one action from a list of or greater feasible movements. - ANS-Branching Statement
Consider the subsequent code:
Employee empl = new Employee();
emp1.SetName("Anna Karenina");
Employee emp2 - new Employee();
emp2.SetName("David Copperfield");
emp2 = emp1;
Which of the following great describes the contents of the two variables emp1 and emp2 after
this code has done? - ANS-emp1 refers back to the object with the name Anna Karenina. Emp2
refers back to the same item.
Consider the following loop that provides up a sequence of numbers?
For (int matter = 1; remember <= n; remember++;)