Vous êtes sur la page 1sur 45

Review Exam 1

CSCI 1301 - 120

Consider the following pseudocode, what does


it produce?
Set n = 0.
Set a = 0.
Set b = 1.
Set p = 1.
Print p.
Repeat until n equals 10
Set p = a + b.
Set a = b.
Set b = p.
Add 1 to n.
Print p.


The language developed by Sun
Microsystems that became the Java
programming language was originally
designed to be simple, secure,
and________

a) easy to use in any language


b) available over the Internet
c) usable for many different processor
types
d) environmentally friendly, or "green"

Java is said to be a "safe" programming


language. What does this mean?
a) Java programs cannot cause
environmental damage because they are
"green".
b) Java programs can run within a browser
without fear that they may attack your
computer.
c) There is no way for a Java program to read
or write a file.
d) Java programs cannot access data across
a computer network

In order for Java to achieve portability

a) compiled Java programs contain


instructions for a virtual machine
b) Java is not compiled
c) Java programs must be re-compiled
on each platform where they are to
run
d) Java programs are based on the C+
+ programming language

A Java Virtual Machine is


a) A theoretical machine to help
understand the computational complexity
of algorithms
b) A program that simulates a real CPU
c) A kind of computer hardware that is
embedded into the CPUs of all computers
using Java
d) A library package that extends the
capability of the Java programming
language

The Java programming language is


itself relatively simple, but also
contains a vast set of ________
a) syntactical variations
b) program templates
c) cross-platform scripting languages

d) library packages

The source code for a Java program


is stored in a file

a) that ends with a .class suffix


b) that can have any valid file name
c) that ends with a .java suffix
d) that has no suffix

A Java "class" file

a) contains Java source code


b) contains instructions to the Java
virtual machine
c) is an internal file created by the
Integrated Development
Environment (IDE)
d) is the translation of the Java
source code into C++

In Java, the statement


System.out.print("hello");;;
a) is a syntax error
b) is a legal statement
c) seems like it should print out
"hello" but doesn't
d) asks the user to enter a value and
stores it in the variable "hello"

A sequence of steps that is


unambiguous, executable, and
terminating is called

a) pseudocode
b) an algorithm
c) a logarithm
d) a programming task

Which of the following options


declares a float variable?

a) Floatage;
b)fltage;
c)floatage;
d)age:float;

What is the result of the following code


snippet?
publicstaticvoidmain(String[]args)
{
doublecircleRadius;
doublecircleVolume;
circleVolume=22/7*circleRadius*circleRadius;
System.out.println(circleVolume);
}

a) 0
b) 3.14
c) 6.28
d) compile-time error

What is the result of the following statement?

Strings ="You" +"had" +"me" +"at" +"hello";


"You had meat hello"
b) The statement results in an error because the + operator can be used only
a) The string s has the following value:
with numbers

c) The statement results in an error because the


performed on string literals

+ operation cannot be

d) The string shas the following value: "Youhadmeathello"

The flow chart shows the order in which


steps should be executed, and the diamondshaped boxes indicate

a) input
b) algorithms
c) tasks
d) conditional tests

When testing code for correctness, it


always makes sense to

a) Test all cases


b) Identify boundary cases and test
them
c) Check all cases by hand
d) Assume invalid input will never
occur

BRING YOUR BOOK


for the exam
ON WEDNESDAY
9/17/012

Vous aimerez peut-être aussi