CIT Chapter 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

method

A __________ contains sequences of programming instructions that describe how to perform a particular task. parameter label variable method

it can be carried out in practice.

A sequence of steps is executable when ___________________________ it will eventually come to an end. it can be carried out in practice. it is documented. there are precise instructions for what to do at each step and where to go next.

it will eventually come to an end.

A sequence of steps is terminating when ___________________________ there are precise instructions for what to do at each step and where to go next. it will eventually come to an end. it can be documented. it can be carried out in practice.

there are precise instructions for what to do at each step and where to go next.

A sequence of steps is unambiguous when ___________________________ it will eventually come to an end. it is clearly documented. it can be carried out in practice. there are precise instructions for what to do at each step and where to go next.

executable

A sequence of steps that can be carried out in practice is ______________. unambiguous terminating executable documented

unambiguous

A sequence of steps that contains precise instructions for what to do at each step and where to go next is ______________. unambiguous terminating executable documented

terminating

A sequence of steps that eventually comes to an end is ______________. unambiguous terminating executable documented

()

Arguments supplied to methods are enclosed by which symbols? () " " {} //

No file is generated due to an error.

Assume that the following Java statement is contained in the main method of the class named Hello: System.out.printLine("Hello!"); What is the name of the file generated by the Java compiler? Hello.java Hello No file is generated due to an error. Hello.class

Welcome.class

Assume that the main method of the class named Welcome does not contain any compile-time errors. What is the name of the file generated by the Java compiler? Welcome.class Welcome.java No additional file is generated. Welcome

There are no errors.

Assuming the programmer wishes to display "Hello!" on the screen, which statement is true about the following Java code fragment: System.out.println("Hello!"); There is a run-time error. There are no errors. There is a compile-time error. There are multiple errors.

There is a run-time error.

Assuming the programmer wishes to display "Hello!" on the screen, which statement is true about the following Java code fragment: System.out.println("Helo!"); There is a run-time error. There are no errors. There is a compile-time error. There are multiple errors.

There are multiple errors.

Assuming the programmer wishes to display "Hello!" on the screen, which statement is true about the following Java code fragment: System.out.printn("Helo!"); There is a run-time error. There are no errors. There is a compile-time error. There are multiple errors.

There is a run-time error.

Assuming the programmer wishes to output the phrase "Hello!", which of the following is true about the following Java statement: System.out.println("Welcme!"); There are multiple errors. There is a run-time error. There are no errors. There is a compile-time error.

There are no errors.

Assuming the programmer wishes to output the phrase "Welcome!", Which statement is true about the following Java statement: System.out.println("Welcome!"); There are no errors. There is a run-time error. There are multiple errors. There is a compile-time error.

There are multiple errors.

Assuming the programmer wishes to output the phrase "Welcome!", which of the following is true about the following Java statement. System.out.Println("Wlcome!"); There are no errors. There is a compile-time error. There is a run-time error. There are multiple errors.

29.2

Evaluate the given pseudocode to calculate the efficiency of a vehicle's fuel consumption using the following test values, rounded to one decimal place: The trip odometer reading (odometer) = 350 The amount to fill the gas tank (amount) = 12 input odometer input amount output odometer/amount What is the final output? 27.7 29.2 34.4 32.3

20

Evaluate the given pseudocode to calculate the efficiency of a vehicle's fuel consumption using the following test values: The trip odometer reading (odometer) = 300 The amount to fill the gas tank (amount) = 15 input odometer input amount output odometer/amount What is the final output? 15 10 30 20

600

Evaluate the given pseudocode to calculate the payment (pmt) with the following test values: The total number of hours worked (working_hours) = 50 The rate paid for hourly work (rate) = 10 input working_hours input rate pmt = working_hours * rate if working_hours > 40 then extra_hours = working_hours - 40 extra_pmt = extra_hours * rate pmt = pmt + extra_pmt end of if output pmt What is the final output? 540 580 500 600

960

Evaluate the given pseudocode to calculate the payment (pmt) with the following test values: The total number of hours worked (working_hours) = 60 The rate paid for hourly work (rate) = 12 input working_hours input rate pmt = working_hours * rate if working_hours > 40 then extra_hours = working_hours - 40 extra_pmt = extra_hours * rate pmt = pmt + extra_pmt output pmt What is the final output? 960 840 240 720

89.80

Evaluate the given pseudocode to calculate the weighted score for a student: The homework score (homework) = 95 The weight of homework (hwWeight) = 35% The exam score (exams) = 87 The weight of exams(exWeight) = 65% input homework input hwWeight input exams input exWeight output homework*hwWeight + exams*exWeight What is the final output? 89.20 89.80 87.80 92.20

87.80

Evaluate the given pseudocode to calculate the weighted score for a student: The program score (program) = 92 The weight of programs (pgmWeight) = 40% The exam score (exams) = 85 The weight of exams(exWeight) = 60% input program input pgmWeight input exams input exWeight output program*pgmWeight + exams*exWeight What is the final output? 89.20 87.80 89.80 92.20

class

Every Java program consists of one or more of these fundamental building blocks. class CPU applet parameter

check for spelling, capitalization, or missing quotation marks

If you get a sequence of error messages from the compiler that are increasingly off track, you should check for division by zero restructure your code to make it more readable check for spelling, capitalization, or missing quotation marks include more of your code within themain method

;

In Java, every statement must end with which symbol? . ) ! ;

A Java compiler translates the source code into class files.

No matter which Java development environment you use, what happens to the Java source code in order for a Java program to execute? The source code is automatically separated into many files. The source code is backed up to a network storage facility. A Java compiler converts all uppercase letters to lowercase. A Java compiler translates the source code into class files.

syntax error

Other than compile-time error, what is another term used to describe an error detected by the compiler that is a violation of the programming language rules? typo logic error syntax error run-time error

logic error

Other than run-time error, what is another term used to describe an error causing a program to take an action that the programmer did not intend? syntax error logic error mistake compile-time error

i, iii, iv

Pseudocode must be i. Unambiguous. ii. Syntactically correct code. iii. Readable by a human. iv. Indicative of results of an algorithm. i, ii i, ii, iii i, iii, iv ii, iii, iv

networks

Some computers are self-contained units; others are interconnected through what? bus networks peripheral devices power lines

Make regular backups of all your important files.

Suppose that a computer virus infects your computer and corrupts the files you were going to submit for your current homework assignment. What precaution could have saved you from a disastrously bad grade for this assignment? Defragment the hard drive. Purchase an anti-virus program to remove the virus from your computer. Make regular backups of all your important files. Purchase an extended warranty for your computer.

spelling

The error message "cannot find symbol" is usually a good clue that what kind of error has been made? logic spelling run-time division by zero

Declaration of the class HelloPrinter.

The line public class HelloPrinter indicates which declaration below? Declaration of the variable class. Declaration of the class HelloPrinter. Declaration of the variable public. Declaration of the class public.

Central Processing Unit

What does CPU stand for? Computer Programming Unit Computer Processing Unit Central Processing Unit Central Programming Unit

A program that is syntactically correct but does not do what it is supposed to do.

What is a logic error? A violation of the rules of the computer language. A missing main method. A program that is syntactically correct but does not do what it is supposed to do. An error that is so severe that it generates an exception.

Add up two numbers.

What is an example of a typical instruction in a computer program? Add up two numbers. Lay out a term paper. Drive a car. Display a fancy font.

A program that simulates a real CPU running compiled Java code.

What is the Java Virtual Machine? A CPU that runs compiled Java code. A library that makes it possible to write portable programs. A program that simulates a real CPU running compiled Java code. A program that translates Java code into machine instructions.

"Welcome"

What is the argument in the given method call? System.out.println("Welcome"); out println "Welcome" System

iii, i, v, ii, iv

What is the correct order of the steps in the program development process: i. Develop and describe the algorithm. ii. Translate the algorithm into Java. iii. Understand the problem. iv. Compile and test the program. v. Test the algorithm with different inputs. iii, i, ii, iv, v i, ii, iv, v, iii iii, i, v, ii, iv i, iii, v, ii, iv

HelloPrinter.java

What is the name of the file that contains the Java source code for the public class HelloPrinter? HelloPrinter HelloPrinter.java HelloPrinter.class HelloPrinter.txt

println

What is the name of the method in the given method call? System.out.println("Welcome"); "Welcome" System println out

4 + 6

What is the output of the following Java statement? System.out.println("4 + 6"); 10 46 4 4 + 6

10

What is the output of the following Java statement? System.out.println(4 + 6); 4 + 6 4 10 46

To find the largest among 10 numbers

What is the purpose of the following algorithm? input num Repeat the following steps for 9 times input var1 if var1 > num then num = var1 print num To print out the 10 numbers To search for a particular number among 10 numbers To find the largest among 10 numbers To find the smallest among 10 numbers

To find the smallest among 15 numbers.

What is the purpose of the following algorithm? input somenum Repeat the following steps for 14 times input variable1 if variable1 < somenum then somenum = variable1 print somenum To search for a particular number among 15 numbers. To find the largest among 15 numbers. To print out the 15 numbers. To find the smallest among 15 numbers.

System.out.println("Any message");

What is the syntax for calling the println method on the object System.out? println("Any message").System.out; System.out("Any message").println; System.out.println("Any message"); println(System.out,"Any message");

run-time error

What is the term used to describe an error causing a program to take an action that the programmer did not intend? typo run-time error compile-time error syntax error

compile-time error

What is the term used to describe an error detected by the compiler that is a violation of the programming language rules? logic error compile-time error run-time error typo

applet

What is the term used to refer to Java code that runs in a browser? applet script html class

string

What term is used to refer to a sequence of characters enclosed in quotation marks? string object comment variable

algorithm

What term is used to refer to a sequence of steps for solving a problem that is unambiguous, executable, and terminating? documentation pseudoprogram algorithm comments

statement

What term is used to refer to an individual instruction inside a method? statement constant comment object

high-level

What term is used to refer to languages that allow programmers to describe tasks at a higher conceptual level than machine code? virtual high-level sophisticated conceptual

machine code

What term is used to refer to the computer instructions that are executed by a CPU? virtual machine machine code high-level code instruction set

argument

What term is used to refer to values supplied to a method that are needed to carry out its task? class object argument comment

compiler

What tool translates Java source code into files that contain instructions for the Java Virtual Machine? linker compiler assembler interpreter

compiler

What tool translates high-level instructions into low level machine code? debugger assembler compiler linker

1995

When was Java officially introduced? 1991 1995 2000 2005

method name, arguments

Whenever a method is called in Java, what must be specified? program name, method name strings, method name method name, arguments the main method, arguments

memory

Where must program instructions and data reside in order for the CPU to directly read and execute them? memory bus hard disk somewhere on the computer network

speakers

Which is an example of a peripheral device? the CPU primary storage motherboard speakers

primary storage

Which memory type does not provide persistent storage? secondary storage hard disk primary storage DVD

You must create an algorithm for a problem before you can create a program to solve the problem.

Which of the following options is true about algorithms? Algorithms are described informally and can contain ambiguous steps. Algorithms are written in a programming language. Algorithms can replace the source code in programs. You must create an algorithm for a problem before you can create a program to solve the problem.

Querying a database

Which one of the following is NOT a function of a CPU? Performing arithmetic operations Processing data and controlling programs Querying a database Fetching and storing data from storage and input devices

secondary storage

Which one of the following memory types provides storage that is slower and less expensive? primary storage secondary storage peripheral device the transistor

secondary storage

Which one of the following memory types provides storage that persists without electricity? primary storage RAM memory secondary storage

A program is a sequence of instructions and decisions that the computer carries out.

Which statement best describes a computer program? A program is a sequence of comments. A program can decide what task it is to perform. A program is a sequence of instructions and decisions that the computer carries out. A program can only perform one simple task.

The same already-compiled Java programs will run on Windows, UNIX, Linux, or Macintosh operating systems without any change.

Which statement best describes the portability characteristic of Java? The same already-compiled Java programs will run on Windows, UNIX, Linux, or Macintosh operating systems without any change. The same Java compiler can be used on many operating systems. There are only small differences between the Java programming language on different operating systems. It is easy to change a Java program so that it will work on different operating systems.

You can take code that has been generated by the Java compiler and run it on different CPUs.

Which statement is true about running a Java program on a different CPU? You need different Java source code for each CPU. You can take code that has been generated by the Java compiler and run it on different CPUs. You need to compile the Java program for each CPU. You cannot run the program on a different CPU because Java, being a high-level programming language, is machine dependent.

The compiler will continue compiling after it finds an error.

Which statement is true about the compilation process? The compiler will generate CPU specific instructions even if it detects an error. The compiler will generate Java virtual machine instructions even if it detects an error. The compiler will stop compiling when it finds the first error. The compiler will continue compiling after it finds an error.

There is a compile-time error.

Which statement is true about the following Java code fragment: System.out.println("Hello!); There is a run-time error. There are no errors. There is a compile-time error. There are multiple errors.

There is a compile-time error.

Which statement is true about the following Java statement: System.out.Println("Welcome!"); There are multiple errors. There are no errors. There is a run-time error. There is a compile-time error.

You should have multiple copies of your source files in different locations.

Which statement regarding backup strategies for Java files is correct? You should have multiple copies of your source files in different locations. You should regularly print out your work so you can retype it in case of data loss. You should regularly back up the Java virtual machine instructions to prevent loss of valuable work. Your compiler automatically makes backups of your source files.

Computer programs are composed of extremely primitive operations.

Which statement regarding computer programs is correct? Computer programs can decide what task to perform. Large and complex computer programs are generally written by only one programmer. Computer programs are composed of extremely primitive operations. Small computer programs are not documented.

hard disk

Which type of secondary storage consists of rotating platters coated with a magnetic material? hard disk solid state drive compact disk (CD) memory

primary storage

Which type of storage is made from electronic circuits that can store data? compact disk (CD) hard disk primary storage secondary storage

programmer

Who or what is responsible for inspecting and testing the program to guard against logic errors? JVM programmer end-user compiler

The tools needed for Java programming are different from other software.

Why should you set aside time to become familiar with the programming environment? The time you spend will prevent data loss without the need for backups. The tools needed for Java programming are different from other software. Although computer systems vary widely, the Java programming environment is always the same. The Java libraries are detailed and extensive.


Kaugnay na mga set ng pag-aaral

Chapter 22: The Child with Gastrointestinal Dysfunction Hockenberry: Wong's Essentials of Pediatric Nursing, 10th Edition

View Set

Chapter 3: Ethics and Law for the Medical Office

View Set

Psychobiological Disorders; Foundations and Practice of Mental Health nursing

View Set

COM Law Ch. 12 continued: Copyright on the internet

View Set

Ch 3 | Basic Cost Management Concepts

View Set

Sociology Chapter 8 Race and Ethnicity

View Set