Wednesday, January 22, 2014

apcs test 1

AP Computer Science                 Chapter 1 Test

Date:9/13/2013

Multiple Choice Questions:

 

1)    6 bits can be used to represent ___ distinct items or values

a)    6

b)    20

c)    24

d)    32

e)    64

 

2)    Which memory capacity is the largest?

a)    1,500,000,000,000 bytes

b)    100 gigabytes

c)    3,500,000 kilobytes

d)    10 terabyte

e)    12,000,000 megabytes

 

3)    Volatility is a property of

a)    RAM

b)    ROM

c)    disk

d)    software

e)    computer networks

 

4)    Which character below is not allowed in an identifier?

a)    $

b)    _

c)    0  (zero)

d)    q

e)    ^

 

5)    Which of the following would be a legal Java identifier?

a)    i

b)    class

c)    ilikeclass!

d)    idon'tlikeclass

e)    i-like-class

 

6)    An error in a program that results in the program outputting $100 instead of the correct answer, $250 is

a)    a programmer error

b)    a syntax error

c)    a run-time error

d)    a logical error

e)    a snafu

 

7)    Following Java naming convention, which of the following would be the best name for a class about store customers?

a)    StoreCustomer

b)    Store Customer

c)    storeCustomer

d)    STORE_CUSTOMER

e)    Store-Customer

 

8)    Which of the following is a legal Java identifier?

a)    1ForAll

b)    oneForAll

c)    one/4/all

d)    1_4_all

e)    1forall

 

9)    Forgetting a semicolon will cause

a)    a syntax error

b)    a run-time error

c)    a logical error

d)    no error at all

e)    converting the statement into a comment

 

10)                    Which of the following would not be syntactically legal in Java?

a)    public class Foo

b)    System.out.println("Hi");

c)    { }

d)    s t a t i c main(String[ ] args)

e)    only b is legally valid, all of the rest are illegal

 

11)     Which of the following characters does not need to have an associated “closing” character in a Java program?

a)       {

b)       (

c)       [

d)       <

e)       all of these require closing characters

 

True/False Questions:

 

1)    Java is an object-oriented programming language.

 

2)    System.out.print is used in a program to denote that a comment follows.

 

3)    The Java compiler is able to find all programmer errors.

 

4)    Java is a case-sensitive language meaning that Current, current, and CURRENT will all reference the same identifier.

 

5)    The word “Public” is a reserved word.

 

6)    In a Java program, dividing by 0 is a syntax error.

 

7)    Binary numbers are composed entirely of 0s and 1s.

 

8)    Mistyping “println” as “printn” will result in a run-time error.

 

9)    The line of Java code   // System.out.println(“Hello”); will cause “Hello” to be output.


 

 

Free-form questions:

 

1)  What is wrong with the following class definition?

public class Program1

{

   public static void main(String[] args)

   {

       System.out.println("My first Java program")

    }

}

 

 

2)  What is wrong with the following println statement?

System.out.println("My fourth Java Program);

 

 

3)   Rewrite the following comment so that it can appear over multiple lines.

//  This is one really enormously long comment that might run off the page

 

 

 

__________

No comments:

Post a Comment