0% found this document useful (0 votes)
100 views

Unit 2 Test

This document contains a student's test results from an ICS unit test. The test consisted of 28 multiple choice and constructed response questions covering topics like Java syntax, data types, classes, methods, and algorithms. The student scored 83% overall, getting most questions in the true/false, application, and comments sections correct but missing some in the key concepts section.

Uploaded by

Extra Email
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views

Unit 2 Test

This document contains a student's test results from an ICS unit test. The test consisted of 28 multiple choice and constructed response questions covering topics like Java syntax, data types, classes, methods, and algorithms. The student scored 83% overall, getting most questions in the true/false, application, and comments sections correct but missing some in the key concepts section.

Uploaded by

Extra Email
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 4

Name: _______________________ Date: ________________________

ICS
Unit 2 Test
Mark 40/48 T/I 11/12 App 11/12 C 12/12 K/U 6/12
83%
Mark TRUE or FALSE: Determine if each of the following are True or False
1T/I 1. Java applications can run only on the Windows platform.
∙ True
∙ False

1T/I 2. Statements must end with a semicolon.


∙ True
∙ False

1T/I 3. Comments have no effect on program execution.


∙ True
∙ False

1T/I 4. The main() method is placed in the controlling class.


∙ True
∙ False

1T/I 5. Related statements are enclosed with brackets ([ ]).


∙ True
∙ False

1T/I 6. A file containing only source code can be executed on a computer.


∙ True
∙ False

1T/I 7. Compiled source code is called machine code.


∙ True
∙ False compiled source code is called bytecode

1T/I 8. A program containing syntax errors will compile.


∙ True
∙ False

1T/I 9. An algorithm is a set of steps that outline how to solve a problem.


∙ True
∙ False
1T/I 10. import statements must appear before any class definitions and
package statement.
∙ True
∙ False
1T/I 11. An identifier can contain spaces.
∙ True
∙ False
1T/I 12. Data of type double is sometimes referred to as floating point.
∙ True
∙ False

1A 13. An abstract data type is also called a primitive data type.


∙ True
∙ False an abstract type is a class

1A 14. Values typed by the user cannot be used in an application.


∙ True
∙ False
1A 15. The Scanner class is part of a Java package.
∙ True
∙ False

1A 16. The + operator has higher precedence than the – operator.


∙ True
∙ False
1A 17. The – operator has lower precedence than the % operator.
∙ True
∙ False
1A 18. byte is a keyword.
∙ True
∙ False
1A 19. The identifiers apple and Apple are considered the same in Java.
∙ True
∙ False
1A 20. Errors that violate the rules of Java are called semantic errors.
∙ True
∙ False

Short answer: Answer the questions in the space provided.

2A 21. Explain the difference between source code and bytecode.

Source code is code written by the user and byte code is code compiled by
the computer into number easter and faster for the computer to use.
2A 22. Explain the difference between the print() and println() methods.

Print puts the cursor behind the line and printIn puts the cursor on the
next line

2Comm 23. Write a declaration that declares a class named AverageScore that
is available to any code.

Public class AverageScore //public should be lower case

5Comm 24. Write an appropriate comment block for the beginning of a program
to describe an application that is intended to calculate test averages.

/*
*TestAvg.java
*calculates test averages
*ben
*ICS3U
*9/28/2020
*/

5Comm 25. Write an algorithm to count the number of words in a sentence.

Get user to input sentence


Assign input to variable
// next time you see 5 marks, expect to put more than 2 lines

7K/U 26. The following application has seven syntax errors. What are they?
6 /*
*Test.java
*What's wrong application.
*Student Name
*ICS3U
*Date
*/
package test;
public class Test
{
public static void main(string[] args) //S
{
System.out.print("Testing …” );
}

2K/U 27. The java.util package contains a class named ArrayList. Write a
statement that makes the ArrayList class accessible to an
application.

ArrayList class = ArrayList new ();


import java.util.ArrayList;

3K/U 28. What is the result of the expression: (x/10)%10

when x is 2005? 2005 0


when x is 1776? 1776 7
when x is 39? 39 3

You might also like