CSE Chapter 1 Quiz

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is the output of the following code snippet? public class PrintIt { public static void main(String[] args) { System.out.println("4 * 4" + 12); } }

4*412

What is the output of the following code snippet? System.out.print(4 + 4); System.out.print(12);

812

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 logic error

An example of an input device that interfaces between computers and humans is

A microphone

A Java Virtual Machine is

A program the simulates a real CPU

Every statement in Java must be terminated with

A semi colon ;

Which of the following statements is valid with respect to the usage of a semicolon in Java?

A semicolon is used to denote the end of a statement.

An example of an output device that interfaces between computers and humans is

A speaker

What is the difference between an editor and a compiler?

An editor allows program files to be written and stored; a compiler converts program files into an executable program

An integrated development environment (IDE) bundles tools for programming into a unified application. What kinds of tools are usually included?

An editor and a compiler

What is a logic error?

An error that occurs when a program is running because, for example, the wrong operator was used.

Small applications written in the Java programming language that can be located anywhere on the Internet are called

Applets

High-level programming languages

Are independent of the underlying hardware

Every Java program consists of one or more

Classes

What kind of error is it when your program has a syntax error?

Compile-time error

Which one of the following translates high-level descriptions into machine code?

Compiler

Which of the following statements is true with respect to the main method in Java?

Every java application must have a main method

Computers are machines that

Execute programs

What is the output of the following code snippet? System.out.print("Hello"); System.out.println("Good Day!");

HelloGood Day!

Computer scientists have devised something that allows programmers to describe tasks in

High-level programming language

Consider the following statements about folders and your integrated development environment (IDE): I. Hierarchical folders help to organize a project. II. Folders are a way to visualize the layout of a file system. III. Folders make it impossible to lose or accidentally delete a file.

I and II only

Which option correctly completes this statement? Programs can repeat simple instructions very quickly to I. help human users to perceive images and sound II. remove the drudgery of repeating instructions by hand III. overcome the need for connectivity to the computer network

I and II only

Which of the following statements regarding backup strategies for Java files are true? I. You should back up your projects often to prevent loss of valuable work. II. You should check your backups only in case of loss of data. III. You should pay attention to the backup direction.

I and III

Which of these are true about writing algorithms in pseudocode? I. The exact wording is not important II. The sequence of steps should be ambiguous III. The algorithm should terminate

I and III

Which pointers about backing up your Java projects are important? I. Check your backups once in a while II. Rely on the Java programming language's built-in back up system III. Back up often

I and III only

What statements about the integrated development environment (IDE) are true? I. You may run Java class files even after exiting the IDE. II. The IDE can invoke a virtual machine, which is required to run a Java program. III. Translating Java source code into class files is enough to then actually run the program.

I, II, III

If you misspell a word in your Java program it may be true that I. the program will not compile II. the program may compile, but not run III. the program may compile and run but still have a logic error

I, II, and III

Which of the following are reasons why Java is good, but not perfect, for beginners? I. A certain amount of technical machinery is necessary to write basic, simple programs II. There are many extensions III. There are a large number of extensive libraries in Java

I, II, and III

Which statements are true? I. In Java, a file can contain at most one public class II. The word public denotes that the class is usable by the "public" III. Every Java program must have a main method

I, II, and III

Consider the following statements regarding computers: I. Computers can execute a large number of instructions in a fraction of a second. II. Computer application areas mainly target the research and scientific communities. III. The physical components of a computer constitute its hardware. IV. Unlike humans, a computer never gets bored or exhausted when performing repetitive tasks. Which is correct?

I, III, IV only

Which one of the following typically provides data persistence without electricity? I. The CPU's memory II. The hard disk III. Secondary storage

II and III only

Consider the following statements about computer programs: I. Computer programs can be written by someone who has a basic knowledge of operating a computer. II. Computer programs can complete complex tasks quickly. III. Large and complex computer programs are generally written by a group of programmers. IV. Computer programs are composed of extremely primitive operations. Which one of the following options is correct?

II, III, and IV only

Programs that are not running are usually stored

In secondary storage

Programmers have embraced Java over its closest rival, C++, mainly because

It is easier to use

When a program begins to run,

It is moved to the CPUs memory

Java is said to be a "safe" programming language. What does this mean?

Java programs can run within a browser without fear that they may attack your computer

What kind of error is created by the following code snippet? System.out.print("The sum of 8 and 12 is "); System.out.println(8 * 12);

Logic error: the program does not produce the desired result

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?

No, because java is case sensitive , these are considered completely different

The ENIAC computer burned out transistors at the rate of

None -- it used vacuum tubes

A Java class with the name Printer has to be saved using the source file name:

Printer.java

What is one of the benefits of using a high-level programming language like Java?

Problems solved in a high-level language are independent of the underlying computer hardware

Who or what is responsible for inspecting and testing the program to guard against logic errors?

Programmer

Which one of the following methodologies is a sequence of steps formulated in English for solving a problem?

Pseudocode

Writing a computer game in Java that has graphics, motion, and sound effects

Requires a team of skilled programmers

The programmer, not the compiler, is responsible for testing a program to identify

Run-time errors

Because Java was designed for the Internet, which two of its attributes make it suitable for beginning programmers?

Safety and portability

Which of the following symbols is used to terminate a Java program statement?

Semi colon

Which of the following refers to a collection of programs that a computer executes?

Software

Characters that are grouped together between double quotes (quotation marks) in Java are called

Strings

What kind of error is created by the following code snippet? System.outt.println("Hello");

Syntax error: the program will not compile

Which one of the following errors represents a part of a program that is incorrect according to the rules of the programming language?

Syntax errors

Which one of the following code snippets compiles without errors and displays the output "Hello Good Day!" on the screen?

System.out.print("Hello "); System.out.println("Good Day!");

Which Java statement does not contain an error?

System.out.println();

Which Java statement prints a blank line?

System.out.println();

How do programmers find exceptions and run-time errors?

Testing by running the program with a variety of input values

Computer programming is

The act of designing and implementing a computer program

Consider a scenario in which you develop a Java program on a computer that has a Pentium processor. What step should you take to run the same Java program on a computer that has a different processor?

The compiled Java machine language instructions can be run on any processor that has a Java Virtual Machine.

When a compiler finds a syntax error in a program, what happens?

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

These two lines of code do not produce the same output. Why? System.out.println(7 + 3); System.out.println("7 + 3");

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

What is the output from this code snippet? System.out.print("The sum is "); System.out.println("7 + 3");

The sum is 7 + 3

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

Usable for many different processor types

The term "applet" refers to

a java program that runs within a web browser

A sequence of steps that is unambiguous, executable, and terminating is called

an algorithm

Some run-time errors are so severe that they generate

an exception

A single silicon chip made from potentially millions of transistors is called

central processing chip (CPU)

In order for Java to achieve portability

compiled Java programs contain instructions for a virtual machine

In order to translate a Java program to a class file, the computer needs to have software called a(n):

compiler

A Java "class" file

contains instructions to the Java virtual machine

The first step in describing an algorithm in pseudocode is

determine the inputs and the outputs

In Java, the statement System.out.print("hello");;;

is a legal statement

The Java programming language is itself relatively simple, but also contains a vast set of

library packages

The Java statement public static void main(String[] args) declares a:

method

The Central Processing Unit is primarily responsible for

performing program control and data processing

Which statement starts the declaration of a class in Java?

public class Classname

Which of the following statements must you include in a Java class that can be executed by the virtual machine?

public static void main(String[] args)

The technical term for the values that a method needs in order to carry out its task is an argument. When there is more than one argument needed by a method, they are

separated by commas

A java virtual machine is:

software

The source code for a Java program is stored in a file

that ends with a .java suffix

Sometimes errors throw the compiler off track because

the compiler does not give up when it finds the first error

During program development, errors are

unavoidable

In order to run Java programs on a computer, the computer needs to have software called a(n):

virtual machine

In order for the ENIAC computer to be re-programmed

wires needed to be plugged into a different wiring configuration

In Java, if you want the compiler to interpret what you type as program instructions, you must

write correct java statements separated by the semi colon


Ensembles d'études connexes

VARCAROLIS Chapter 28: Child, Older Adult, and Intimate Partner Violence

View Set

relations & functions assignment

View Set

Securities Licence Exam Finance Unit 1

View Set

The French Revolution (1789-1799)

View Set

Chapter 5: Interests in Real Estate

View Set