Sunteți pe pagina 1din 24

Jamu medtrem

Section 2 Quiz
(Answer all questions in this section)

1. What is the correct order of steps in the Spiral Model of Development? Mark for Review
(1) Points

Design, Requirements, Develop, Test


Design, Develop , Requirements, Test
Requirements, Design, Test, Develop
Requirements, Design, Develop, Test (*)

Incorrect. Refer to Section 2 Lesson 1.

2. A software feature may allow the user to perform a specific task. Mark for Review
(1) Points

True (*)
False

Correct

3. You’d like to see a movie with a few friends. You write an email to confirm plans. Mark for Review
Hi Friends, (1) Points
There’s a new movie “Attack of the Duke!” premiering this Friday at Oracle Cinema
at 4:30 PM. The cinema is at the corner of South Street and Walnut Ave. Subway
would be the best way to get there.

Would any of you be interested in going?

Which of the following are requirements for this plan?

Reach the cinema by 4:00 PM.


Travel via subway.
Double check the location by verifying you’re on South Street and Walnut
Ave.
Watch “Attack of the Duke!” on Friday at Oracle Cinema at 4:30 PM. (*)

Incorrect. Refer to Section 2 Lesson 1.

4. The Spiral Model reflects an iterative development process. Mark for Review
(1) Points

True (*)
False

Correct
5. There are several fields and methods in a Shirt class. Which of the following could Mark for Review
be a method in the Shirt class?
(1) Points

price
size
getShirtSize() (*)
color

Incorrect. Refer to Section 2 Lesson 3.


6. An object
Mark for Review
may
interact (1) Points
with
another
object by
invoking
methods.

True (*)
False

Incorrect. Refer to Section 2 Lesson 3.

7. You design a Circle class with various fields and methods. Which of the Mark for Review
following could be fields in this class? Distinguish which of these are between
the properties and behavior. (1) Points

(Choose all correct answers)

calculateDiameter()
calculateArea()
color (*)
radius (*)
calculateCircumference()

Incorrect. Refer to Section 2 Lesson 3.

8. Which of the following language is called a procedural language? Mark for Review
(1) Points

Java
Java C
C (*)
C++

Incorrect. Refer to Section 2 Lesson 3.

9. You have a beautiful garden at home. On Sunday, you start budding your Mark for Review
rose plant to make few more samples of rose plants to plant in the garden.
Can you categorize how this scenario could be represented by classes and (1) Points
instances?
Rose plant is the class and the samples generated from the rose plant
are instances of that class. (*)
Rose plant is the object and samples are not instances of the plant
because they have not grown yet.
Samples are the class and the rose plant is the instances of samples.
Samples of the rose plant are called classes and not the actual rose
plant.

Correct

10. What is the purpose of adding comments in the code? Mark for Review
(1) Points

To provide better security to the program.


Provide good look and feel of the code.
Provide an explanation about the code to the programmer. (*)
It increases the execution time of the code.

Incorrect. Refer to Section 2 Lesson 2.


11. Which of Mark for Review
the
following (1) Points
three
statements
are true
about
breakpoint?

(Choose all correct answers)

They abruptly ends the code execution.


They can be used to check the current state of the program (*)
They help with debugging. (*)
They insert break statements.
They pause code execution. (*)

Incorrect. Refer to Section 2 Lesson 2.

12. Which of the following 2 statements are true about whitespace? Mark for Review
(1) Points

(Choose all correct answers)

Whitespace eliminates typing mistakes while programming.


Whitespace makes your code more readable. (*)
Whitespace increases execution time of your program.
Whitespace reduces the performance of the program.
Whitespace helps to keep your code organized. (*)

Incorrect. Refer to Section 2 Lesson 2.


13. You can set any number of breakpoints for your program. Mark for Review
(1) Points

True (*)
False

Correct

14. Which of the following two features are supported by the NetBeans IDE. Mark for Review
(1) Points

(Choose all correct answers)

NetBeans highlights matching braces. (*)


NetBeans provides a shortcut to format whitespace. (*)
NetBeans automatically runs the program once all the braces in the
code are matched.
Once NetBeans spots a problem, it won’t allow you to continue
coding until the progrblem is fixed.

Incorrect. Refer to Section 2 Lesson 2.

15. Java mostly reads code line-by-line. Mark for Review


(1) Points

True (*)
False

Correct
Section 2 Quiz
(Answer all questions in this section)

1. Java mostly reads code line-by-line. Mark for Review


(1) Points

True (*)
False

Correct

2. A Java program can be written in the single line. Mark for Review
(1) Points

True (*)
False

Incorrect. Refer to Section 2 Lesson 2.


3. Code within curly braces is called a “Block of code”. Mark for Review
(1) Points

True (*)
False

Correct

4. Which of the following two features are supported by the NetBeans IDE. Mark for Review
(1) Points

(Choose all correct answers)

NetBeans provides a shortcut to format whitespace. (*)


Once NetBeans spots a problem, it won’t allow you to continue coding until
the progrblem is fixed.
NetBeans highlights matching braces. (*)
NetBeans automatically runs the program once all the braces in the code are
matched.

Incorrect. Refer to Section 2 Lesson 2.

5. Which of the following are considered Whitespace? Mark for Review


(1) Points

(Choose all correct answers)

Space between the [ ] braces.


Space in the print statements.
Blank lines in the code. (*)
Indentation before the code. (*)
Space between words. (*)

Incorrect. Refer to Section 2 Lesson 2.


6. What is
Mark for Review
the
purpose (1) Points
of adding
comments
in the
code?

Provide good look and feel of the code.


It increases the execution time of the code.
To provide better security to the program.
Provide an explanation about the code to the programmer. (*)

Incorrect. Refer to Section 2 Lesson 2.


7. You have a beautiful garden at home. On Sunday, you start budding your Mark for Review
rose plant to make few more samples of rose plants to plant in the garden.
Can you categorize how this scenario could be represented by classes and (1) Points
instances?

Samples of the rose plant are called classes and not the actual rose
plant.
Rose plant is the object and samples are not instances of the plant
because they have not grown yet.
Rose plant is the class and the samples generated from the rose plant
are instances of that class. (*)
Samples are the class and the rose plant is the instances of samples.

Incorrect. Refer to Section 2 Lesson 3.

8. You design a Circle class with various fields and methods. Which of the Mark for Review
following could be fields in this class? Distinguish which of these are
between the properties and behavior. (1) Points

(Choose all correct answers)

calculateDiameter()
calculateCircumference()
color (*)
calculateArea()
radius (*)

Incorrect. Refer to Section 2 Lesson 3.

9. Which of the following language is called a procedural language? Mark for Review
(1) Points

C++
Java
C (*)
Java C

Incorrect. Refer to Section 2 Lesson 3.

10. An object may interact with another object by invoking methods. Mark for Review
(1) Points

True (*)
False

Correct
11. There Mark for Review
are
several (1) Points
fields
and
methods
in a Shirt
class.
Which of
the
following
could be
a
method
in the
Shirt
class?

size
color
getShirtSize() (*)
price

Incorrect. Refer to Section 2 Lesson 3.

12. A software feature may allow the user to perform a specific task. Mark for Review
(1) Points

True (*)
False

Correct

13. Which of the following are adequate definitions for components of the Spiral Mark for Review
Model of Development?
(1) Points

(Choose all correct answers)

Test: Run the code and verify results (*)


Requirements: Start the development
Design: Plan the approach (*)
Develop: Collect all specified instructions

Incorrect. Refer to Section 2 Lesson 1.

14. What is the correct order of steps in the Spiral Model of Development? Mark for Review
(1) Points

Requirements, Design, Develop, Test (*)


Design, Requirements, Develop, Test
Requirements, Design, Test, Develop
Design, Develop , Requirements, Test

Correct
15. You’d like to see a movie with a few friends. You write an email to confirm Mark for Review
plans.
(1) Points
Hi Friends,
There’s a new movie “Attack of the Duke!” premiering this Friday at Oracle
Cinema at 4:30 PM. The cinema is at the corner of South Street and Walnut
Ave. Subway would be the best way to get there.

Would any of you be interested in going?

Which of the following are requirements for this plan?

Travel via subway.


Reach the cinema by 4:00 PM.
Double check the location by verifying you’re on South Street and
Walnut Ave.
Watch “Attack of the Duke!” on Friday at Oracle Cinema at 4:30 PM.
(*)

Incorrect. Refer to Section 2 Lesson 1.

Section 2 Quiz
(Answer all questions in this section)

1. What is the correct order of steps in the Spiral Model of Development? Mark for Review
(1) Points

Requirements, Design, Test, Develop


Design, Develop , Requirements, Test
Design, Requirements, Develop, Test
Requirements, Design, Develop, Test (*)

Incorrect. Refer to Section 2 Lesson 1.

2. The Spiral Model reflects an iterative development process. Mark for Review
(1) Points

True (*)
False

Correct

3. During the Testing phase of software development, which of the following are the Mark for Review
tasks undertaken by the programmer?
(1) Points

(Choose all correct answers)

Finding the bugs. (*)


Fixing the bugs. (*)
Listing required features.
Planning the order to implement features.
Incorrect. Refer to Section 2 Lesson 1.

4. You’d like to see a movie with a few friends. You write an email to confirm plans. Mark for Review
Hi Friends, (1) Points
There’s a new movie “Attack of the Duke!” premiering this Friday at Oracle
Cinema at 4:30 PM. The cinema is at the corner of South Street and Walnut Ave.
Subway would be the best way to get there.

Would any of you be interested in going?

Which of the following are requirements for this plan?

Travel via subway.


Watch “Attack of the Duke!” on Friday at Oracle Cinema at 4:30 PM. (*)
Double check the location by verifying you’re on South Street and Walnut
Ave.
Reach the cinema by 4:00 PM.

Incorrect. Refer to Section 2 Lesson 1.

5. Java mostly reads code line-by-line. Mark for Review


(1) Points

True (*)
False

Correct
6. You can set Mark for Review
any number
of (1) Points
breakpoints
for your
program.

True (*)
False

Incorrect. Refer to Section 2 Lesson 2.

7. Which two are the correct syntax for adding comments? Mark for Review
(1) Points

(Choose all correct answers)

Start with two slashes (//). End when the line ends. (*)
Start with a slash- star (/*). End with slash-star (/*).
Start with two slashes (//). End with two slashes (//).
Start with two slashes and a star (//*). End with a star-slash (*/).
Start with a slash-star (/*). End with a star-slash (*/). (*)
Incorrect. Refer to Section 2 Lesson 2.

8. A breakpoint can be set by clicking a number in the left margin of the Mark for Review
IDE. Clicking again removes the breakpoint.
(1) Points

True (*)
False

Correct

9. Which of the following two features are supported by the NetBeans IDE. Mark for Review
(1) Points

(Choose all correct answers)

NetBeans automatically runs the program once all the braces in the
code are matched.
NetBeans provides a shortcut to format whitespace. (*)
Once NetBeans spots a problem, it won’t allow you to continue
coding until the progrblem is fixed.
NetBeans highlights matching braces. (*)

Incorrect. Refer to Section 2 Lesson 2.

10. What is the purpose of adding comments in the code? Mark for Review
(1) Points

It increases the execution time of the code.


Provide good look and feel of the code.
To provide better security to the program.
Provide an explanation about the code to the programmer. (*)

Incorrect. Refer to Section 2 Lesson 2.


11. You have a Mark for Review
beautiful
garden at (1) Points
home. On
Sunday, you
start
budding your
rose plant to
make few
more
samples of
rose plants
to plant in
the garden.
Can you
categorize
how this
scenario
could be
represented
by classes
and
instances?

Samples are the class and the rose plant is the instances of
samples.
Rose plant is the class and the samples generated from the rose
plant are instances of that class. (*)
Samples of the rose plant are called classes and not the actual
rose plant.
Rose plant is the object and samples are not instances of the
plant because they have not grown yet.

Incorrect. Refer to Section 2 Lesson 3.

12. Which of the following language is called a procedural language? Mark for Review
(1) Points

C++
Java
C (*)
Java C

Incorrect. Refer to Section 2 Lesson 3.

13. In object oriented programming, an object comprises of properties and Mark for Review
behaviors where properties represented as fields of the object and
behavior is represented as method. (1) Points

True (*)
False

Incorrect. Refer to Section 2 Lesson 3.

14. An object may interact with another object by invoking methods. Mark for Review
(1) Points

True (*)
False

Correct

15. You design a Circle class with various fields and methods. Which of the Mark for Review
following could be fields in this class? Distinguish which of these are
between the properties and behavior. (1) Points

(Choose all correct answers)

radius (*)
calculateArea()
calculateDiameter()
color (*)
calculateCircumference()

Incorrect. Refer to Section 2 Lesson 3.


Section 3 Quiz 1 - L1-L2
(Answer all questions in this section)

1. Which of the following two statements are true about variables? Mark for Review
(1) Points

(Choose all correct answers)

Variables will be ignored by compiler.


The value assigned to a variable may never change.
The allow code to be edited more efficiently. (*)
They make code becomes flexible. (*)

Incorrect. Refer to Section 3 Lesson 1.

2. Which two statements will not compile? Mark for Review


(1) Points

(Choose all correct answers)

int abc = 10;


double double=10; (*)
int break=10; (*)
double salary = 20000.34;
int age=20;

Incorrect. Refer to Section 3 Lesson 1.

3. Which two data types are appropriate for their variable? Mark for Review
(1) Points

(Choose all correct answers)

boolean age = 20;


int averageDollarAmount = 19.95;
double checkingAmount = 1500; (*)
String firstName = “Alex”; (*)

Incorrect. Refer to Section 3 Lesson 1.

4. Assigning a value to the variable is called “initialization”. Mark for Review


(1) Points

True (*)
False

Correct

5. What is the output? Mark for Review


public class Welcome { (1) Points
public static void main(String args[]) {
System.out.println("This is my first program");
int a = 2;
System.out.println("a is" + a);
}
}

This is my first program


This is my first program a is 2 (*)
a=2
This is my first program a is + a

Correct

6. Which Mark for Review


two
are (1) Points
valid?

(Choose all correct answers)

double doubleVar1; doubleVar2 = 3.1.


double doubleVar1, double doubleVar2 = 3.1;
double doubleVar1, doubleVar2 = 3.1; (*)
double doubleVar1 = 3.1; double doubleVar2 = 3.1; (*)

Incorrect. Refer to Section 3 Lesson 1.

7. Which is valid syntax to declare and initialize a String variable? Mark for Review
(1) Points

String “x” = “Java”;


String x = Java;
String x= “Java”; (*)
String “x” = Java;

Incorrect. Refer to Section 3 Lesson 1.

8. What is the output? Mark for Review


public class Person { (1) Points
public static void main(String args[]) {
int age = 20;
System.out.println("Value of age: " +age);
age = 5 + 3;
System.out.println("Value of age: " +age);
age = age + 1;
age++;
System.out.println("Value of age: " +age);
}
}

Value of age: 20
Value of age: 8
Value of age: 10 (*)
Value of age: 20
Value of age: 28
Value of age: 38
Value of age: 20
Value of age: 208
Value of age: 20810
Value of age: 20
Value of age: 8
Value of age: 9

Correct

9. What value is assigned to x? Mark for Review


int x = 25 - 5 * 4 / 2 - 10 + 4; (1) Points

8
9 (*)
34
7

Incorrect. Refer to Section 3 Lesson 2.

10. What is the output? public static void main(String args[]) { Mark for Review
int x = 100;
int y = x; (1) Points
y++;
System.out.println("Value of x is " + x);
System.out.println("Value of y is " + y);
}

Value of x is 0
Value of y is 1
Value of x is 100
Value of y is 1
Value of x is 100
Value of y is 1
Value of x is 100
Value of y is 101 (*)

Incorrect. Refer to Section 3 Lesson 2.


11. What Mark for Review
is the
range (1) Points
of the
byte
data
type?
–27 to 27–1 (*)
–215 to 215–1
–231 to 231–1
–263 to 263–1

Correct

12. Which two are recommended practices for naming final variables? Mark for Review
(1) Points

(Choose all correct answers)

Capitalize every letter (*)


Separate words with an underscore (*)
Capitalize first letter
Separate words with an space

Incorrect. Refer to Section 3 Lesson 2.

13. This declaration represents a long data type. Mark for Review
long a = 123L;
(1) Points

True (*)
False

Incorrect. Refer to Section 3 Lesson 2.

14. How many bits are in a byte? Mark for Review


(1) Points

2
4
6
7
8 (*)

Correct

15. Assuming x is an int, which of the following are ways to increment the value Mark for Review
of x by 1?
(1) Points

(Choose all correct answers)

x = x +1; (*)
x = +1;
x+;
x++; (*)
x += 1; (*)

Incorrect. Refer to Section 3 Lesson 2.


Section 3 Quiz 1 - L1-L2
(Answer all questions in this section)

1. What value is assigned to x? Mark for Review


int x = 25 - 5 * 4 / 2 - 10 + 4; (1) Points

8
9 (*)
34
7

Incorrect. Refer to Section 3 Lesson 2.

2. What is the output? Mark for Review


public class Person { (1) Points
public static void main(String args[]) {
int age = 20;
System.out.println("Value of age: " +age);
age = 5 + 3;
System.out.println("Value of age: " +age);
age = age + 1;
age++;
System.out.println("Value of age: " +age);
}
}

Value of age: 20
Value of age: 8
Value of age: 10 (*)
Value of age: 20
Value of age: 28
Value of age: 38
Value of age: 20
Value of age: 208
Value of age: 20810
Value of age: 20
Value of age: 8
Value of age: 9

Correct

3. What is the output? public static void main(String args[]) { Mark for Review
int x = 100;
int y = x; (1) Points
y++;
System.out.println("Value of x is " + x);
System.out.println("Value of y is " + y);
}

Value of x is 0
Value of y is 1
Value of x is 100
Value of y is 1
Value of x is 100
Value of y is 1
Value of x is 100
Value of y is 101 (*)

Incorrect. Refer to Section 3 Lesson 2.

4. Which of the following data types is the largest? Mark for Review
(1) Points

byte
short
int
long (*)

Incorrect. Refer to Section 3 Lesson 2.

5. Which two are recommended practices for naming final variables? Mark for Review
(1) Points

(Choose all correct answers)

Capitalize every letter (*)


Separate words with an underscore (*)
Capitalize first letter
Separate words with an space

Incorrect. Refer to Section 3 Lesson 2.


6. Which keyword Mark for Review
makes a
variable’s value (1) Points
unchangeable?

const
final (*)
static
break

Correct

7. What is the range of the byte data type? Mark for Review
(1) Points

–27 to 27–1 (*)


–215 to 215–1
–231 to 231–1
–263 to 263–1

Incorrect. Refer to Section 3 Lesson 2.


8. Which two are mathematical operators? Mark for Review
(1) Points

(Choose all correct answers)

+ (*)
– (*)
#
@

Incorrect. Refer to Section 3 Lesson 2.

9. What is the output? Mark for Review


public class Welcome { (1) Points
public static void main(String args[]) {
System.out.println("This is my first program");
int a = 2;
System.out.println("a is" + a);
}
}

a=2
This is my first program a is 2 (*)
This is my first program a is + a
This is my first program

Correct

10. Which of the following two statements are true about variables? Mark for Review
(1) Points

(Choose all correct answers)

The value assigned to a variable may never change.


The allow code to be edited more efficiently. (*)
They make code becomes flexible. (*)
Variables will be ignored by compiler.

Incorrect. Refer to Section 3 Lesson 1.


11. Assigning a Mark for Review
value to the
variable is (1) Points
called
“initialization”.

True (*)
False

Correct
12. Which two statements will not compile? Mark for Review
(1) Points

(Choose all correct answers)

int break=10; (*)


double salary = 20000.34;
int age=20;
int abc = 10;
double double=10; (*)

Incorrect. Refer to Section 3 Lesson 1.

13. Which is valid syntax to declare and initialize a String variable? Mark for Review
(1) Points

String “x” = Java;


String x = Java;
String x= “Java”; (*)
String “x” = “Java”;

Incorrect. Refer to Section 3 Lesson 1.

14. Identify the names of two variables used in the given code. Mark for Review
public class Variables { (1) Points
public static void main(String args[]) {
String strVal = "Hello";
int intVal = 0;
System.out.println("Integer: " +intVal)
}
}

(Choose all correct answers)

String
intVal (*)
Hello
int
strVal (*)

Incorrect. Refer to Section 3 Lesson 1.

15. Java is a strongly typed language; therefore you must declare a data Mark for Review
type for all variables.
(1) Points

True (*)
False
Correct
Section 3 Quiz 1 - L1-L2
(Answer all questions in this section)

1. What value is assigned to x? Mark for Review


int x = 25 - 5 * 4 / 2 - 10 + 4; (1) Points

8
9 (*)
34
7

Incorrect. Refer to Section 3 Lesson 2.

2. Which two are recommended practices for naming final variables? Mark for Review
(1) Points

(Choose all correct answers)

Capitalize every letter (*)


Separate words with an underscore (*)
Capitalize first letter
Separate words with an space

Correct

3. Which of the following data types is the largest? Mark for Review
(1) Points

byte
short
int
long (*)

Correct

4. Assuming x is an int, which of the following are ways to increment the value of x Mark for Review
by 1?
(1) Points

(Choose all correct answers)

x = x +1; (*)
x = +1;
x+;
x++; (*)
x += 1; (*)
Incorrect. Refer to Section 3 Lesson 2.

5. How many bits are in a byte? Mark for Review


(1) Points

2
4
6
7
8 (*)

Incorrect. Refer to Section 3 Lesson 2.


6. Which two Mark for Review
are
mathematical (1) Points
operators?

(Choose all correct answers)

+ (*)
– (*)
#
@

Correct

7. This declaration represents a long data type. Mark for Review


long a = 123L;
(1) Points

True (*)
False

Correct

8. What is the output? Mark for Review


public class Person { (1) Points
public static void main(String args[]) {
int age = 20;
System.out.println("Value of age: " +age);
age = 5 + 3;
System.out.println("Value of age: " +age);
age = age + 1;
age++;
System.out.println("Value of age: " +age);
}
}

Value of age: 20
Value of age: 8
Value of age: 10 (*)
Value of age: 20
Value of age: 28
Value of age: 38
Value of age: 20
Value of age: 208
Value of age: 20810
Value of age: 20
Value of age: 8
Value of age: 9

Correct

9. Which is valid syntax to declare and initialize a String variable? Mark for Review
(1) Points

String “x” = “Java”;


String x= “Java”; (*)
String “x” = Java;
String x = Java;

Incorrect. Refer to Section 3 Lesson 1.

10. Identify the variable declared in the given code. Mark for Review
public class Welcome { (1) Points
public static void main(String args[]) {
int a = 2;
System.out.println("a is" + a);
}
}

int
a (*)
2
Welcome

Incorrect. Refer to Section 3 Lesson 1.

11. Java is a Mark for Review


strongly
typed (1) Points
language;
therefore
you must
declare a
data type
for all
variables.

True (*)
False

Correct
12. Identify the names of two variables used in the given code. Mark for Review
public class Variables { (1) Points
public static void main(String args[]) {
String strVal = "Hello";
int intVal = 0;
System.out.println("Integer: " +intVal)
}
}

(Choose all correct answers)

intVal (*)
Hello
String
int
strVal (*)

Incorrect. Refer to Section 3 Lesson 1.

13. What is the output? Mark for Review


public class Welcome { (1) Points
public static void main(String args[]) {
System.out.println("This is my first program");
int a = 2;
System.out.println("a is" + a);
}
}

a=2
This is my first program a is + a
This is my first program
This is my first program a is 2 (*)

Incorrect. Refer to Section 3 Lesson 1.

14. Which two statements will not compile? Mark for Review
(1) Points

(Choose all correct answers)

int break=10; (*)


int abc = 10;
int age=20;
double double=10; (*)
double salary = 20000.34;

Incorrect. Refer to Section 3 Lesson 1.

15. Which two are valid? Mark for Review


(1) Points
(Choose all correct answers)

double doubleVar1; doubleVar2 = 3.1.


double doubleVar1 = 3.1; double doubleVar2 = 3.1; (*)
double doubleVar1, double doubleVar2 = 3.1;
double doubleVar1, doubleVar2 = 3.1; (*)

Incorrect. Refer to Section 3 Lesson 1.

S-ar putea să vă placă și