click below
click below
Normal Size Small Size show me how
Comp. Prog. Exam01
Computer Programing basics
Question | Answer |
---|---|
What are three problem solving techniques presented in class? | Draw a picture, count, stepwise refinement, adopt a different perspective, add/remove a constraint, prototype. |
If you need to store information in a Java program, where do you store it? | In a variable |
How do you change the value of a variable? | Use and assignment statement. |
Assume you have an Object, called anObject. Write a statement to send it a doStuff message which has no parameters. | anObject.doStuff() |
What is “pixel” an abbreviation for? What does it mean? | Picture element, one dot on the screen |
Write Java code to declare an variable of type Flopsy, named bunny. | Flopsy bunny; |
Create an object of type Flopsy and store it in bunny | bunny = new Flopsy(); |
Assuming it exists, what method in the Flopsy class is invoked by System.out.println(bunny); ? | toString() |
How do you send information along with a message to an object? | Put it in a parameter. |
Java is a typed language. What does that mean? | All information in the program has a type. 11. |
How many colors (exactly) are possible in Java? | 256 ^3 |
What are the three attributes of every variable? | Type name value |
What must every identifier in Java start with? | A letter. |
What characters are allowed in Java identifiers? | Letters, digits, and underscores. |
Assuming a programmer is following the capitalization convention, is foo a variable or a class? | An Object |
What are three Java statements we have covered so far? | Assignment, Return, Message |
Computing is information processing”; how is most processing accomplished in Java? | By sending messages to objects. |
Why are accessors called accessors? | They allow objects to access the values in variables inside other objects. |
Write Java code to declare an variable of type Foo named aFoo. | Foo aFoo; |
Where is information stored in a Java program? | In variables |
Java is a typed language, so all information in a Java program has a type. Name two types you have used in your programs. | int, String, Button |
Which, by convention, begin with small letters, object or class names? | object names |