IST 140-Java-Chapter 1

Ace your homework & exams now with Quizwiz!

An integrated development environment (IDE) bundles tools for programming into a unified application. What kinds of tools are usually included? a) an editor and a compiler b) a web browser c) presentation tools d) source files and class files

a) an editor and a compiler

What kind of error is it when your program has a syntax error? a) Compile-time error b) Logic error c) Run-time error d) Exception

a) Compile-time error

Every Java program consists of one or more a) Values (arguments) b) Classes c) Strings d) System.out.println statements

b) Classes

Suppose you examine a simple Java program and the first line is public Class HelloPrinter. Is this the same thing in Java as the line public Class helloprinter? a) No, because Java is case-sensitive, these are considered to be completely distinct b) No, because "helloprinter" is misspelled, the Java compiler will reject it c) Yes, because these Java symbols both have the same letters, they are considered to be the same d) Yes, because all Java symbols must have exactly twelve characters

a) No, because Java is case-sensitive, these are considered to be completely distinct

Who or what is responsible for inspecting and testing the program to guard against logic errors? a) Programmer b) IDE c) Compiler d) End-user

a) Programmer

What is the purpose of the following algorithm, written in pseudocode? num = 0 Repeat the following steps 10 times Input var1 If var1 > num Num = var1 Print num a) To find the highest among 10 numbers b) To print out the 10 numbers c) To find the smallest among 10 numbers d) To search for a particular number among 10 numbers

a) To find the highest among 10 numbers

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) compiled Java programs contain instructions for a virtual machine

While developing a program, the programmer adds the discount amount to the total due instead of subtracting it. What type of an error is this? a) Syntax error b) Logic error c) Hardware error d) Compile-time error

b) Logic error

A sequence of steps that is unambiguous, executable, and terminating is called a) pseudocode b) an algorithm c) a logarithm d) a programming task

b) an algorithm

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 IDE d) is the translation of the Java source code into C++

b) contains instructions to the Java virtual machine

Which statement starts the declaration of a class in Java? a) public static void main(String[] args) b) public class Classname c) System.out.println("Hello, World!"); d) Java class

b) public class Classname

In order to run Java programs on a computer, the computer needs to have software called a(n): a) assembler b) virtual machine c) windows d) debugger

b) virtual machine

What is the output of the following code snippet? System.out.print("Hello"); System.out.println("Good Day!"); a) Hello Good Day! b) Hello Good Day! c) HelloGood Day! d) HelloGoodDay!

c) HelloGood Day!

What is the output of the following code snippet? System.out.print(4 + 4); System.out.print(12); a) 4 + 412 b) 4412 c) 812 d) 20

c) 812

Which one of the following typically provides data persistence without electricity? I. The CPU's memory II. The hard disk III. Secondary storage a) I, II only b) I, III only c) II, III only d) I, II, III

c) II, III only

These two lines of code do not produce the same output. Why? System.out.println(7 + 3); System.out.println("7 + 3"); a) Arithmetic calculations cannot take place within the println method call b) In fact, the two statements do produce the same output c) The quotes cause the second expression to be treated as a string d) Because there are no escape characters

c) The quotes cause the second expression to be treated as a string

Which one of the following translates high-level descriptions into machine code? a) assembler b) linker c) compiler d) editor

c) compiler

Programs that are not running are usually stored: a) in the CPU's memory b) on the computer monitor c) in secondary storage d) on a backup device that is in a different physical location from the computer

c) in secondary storage

Which of the following statements is true with respect to the main method in Java? a) The opening and closing parentheses after the method name main are optional. b) A semicolon is required after the statement public static void main() c) A semicolon is required after the closing curly braces in the main method. d) Every Java application must have a main method.

d) Every Java application must have a main method.

When a compiler finds a syntax error in a program, what happens? a) The compiler goes ahead and produces a Java class file, but leaves out the statement where there was an error. b) The compiler stops immediately. c) The compiler requests input from the user before it will continue. d) The compiler continues and may report about other errors but does not produce a Java class file.

d) The compiler continues and may report about other errors but does not produce a Java class file.

The Java statement public static void main(String[] args) declares a: a) class b) variable c) constant d) method

d) method

Characters that are grouped together between double quotes (quotation marks) in Java are called a) reserved words b) syntax c) symbols d) strings

d) strings


Related study sets

accounting 320 Intangibles chapter 12

View Set

Women and Gender History Midterm

View Set

Chapter 51: Alterations in the Endocrine syste

View Set

CITI - Privacy and Confidentiality - SBE

View Set

HUN2201- Chapter 6 (Study Guide)

View Set

Spanish- Prueba 4 (imperfect tense)

View Set