




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
ASU CSE 110 FINAL JAVA FALL WINTER 2022 EXAM SCRIPT 2026 UPDATED QUESTIONS WITH DETAILED ANSWERS GRADED A+
Typology: Exams
1 / 351
This page cannot be seen from the preview
Don't miss anything!





























































































⩥ Computers are machines that. Answer: execute programs ⩥ Computer programming is. Answer: the act of designing and implementing a computer program ⩥ 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 are true?. Answer: I, III, IV ⩥ 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 are true?. Answer: II, III, IV ⩥ The Central Processing Unit is primarily responsible for. Answer: performing program control and data processing ⩥ A single silicon chip made from potentially millions of transistors is called. Answer: a Central Processing Unit (CPU)
Answer: The compiled Java machine language instructions can be run on any processor that has a Java Virtual Machine ⩥ High-level programming languages. Answer: are independent of the underlying hardware ⩥ Which one of the following translates high-level descriptions into machine code?. Answer: compiler ⩥ Computer scientists have devised something that allows programmers to describe tasks in words that are closer to the syntax of the problems being solved. This is called (an). Answer: high-level programming language ⩥ Small applications written in the Java programming language that can be located on the Internet are called. Answer: applets ⩥ What is one of the benefits of using a high-level programming language like Java?. Answer: Problems solved in a high-level language are independent of the underlying computer ⩥ Because Java was designed for the Internet, which two of its attributes make it suitable for beginning programmers?. Answer: Safety and portability
⩥ An integrated development environment (IDE) bundles tools for programming into a unified application. What kinds of tools are usually included?. Answer: An editor and a compiler ⩥ 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. Answer: I, II, III ⩥ What is the difference between an editor and a compiler?. Answer: An editor allows program files to be written and stored; a compiler converts program files into an executable program ⩥ 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 ' ?. Answer: No, because Java is case-sensitive, these are considered to be completely distinct
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. Answer: I, III ⩥ Every Java program consists of one or more. Answer: classes ⩥ Characters that are grouped together between double quotes (quotation marks) in Java are called. Answer: strings ⩥ Every statement in Java must be terminated with. Answer: the semi- colon character ; ⩥ These two lines of code do not produce the same output. Why? System.out.println(7 + 3); System.out.println("7 + 3");. Answer: 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");. Answer: The sum is 7 + 3 ⩥ Which of the following symbols is used to terminate a Java program statement?. Answer: semicolon ⩥ Which of the following statements is valid with respect to the usage of a semicolon in Java?. Answer: A semicolon is used to denote the end of a statement ⩥ Which of the following statements is true with respect to the main method in Java?. Answer: Every Java application must have a main method ⩥ A Java class with the name Printer has to be saved using the source file name:. Answer: Printer.java ⩥ Which statement starts the declaration of a class in Java?. Answer: public class Classname ⩥ Which Java statement prints a blank line?. Answer: System.out.println();
System.out.println(8*12);. Answer: Logic error: the program does not produce the desired result ⩥ What is a logic error?. Answer: An error that occurs when a program is running because, for example, the wrong operator was used ⩥ How do programmers find exceptions and run-time errors?. Answer: Testing by running the program with a variety of input values ⩥ The programmer, not the compiler, is responsible for testing a program to identify. Answer: Run-time errors ⩥ Which one of the following errors represents a part of a program that is incorrect according to the rules of the programming language?. Answer: Syntax errors ⩥ Who or what is responsible for inspecting and testing the program to guard against logic errors?. Answer: Programmer ⩥ When developing a program, the programmer adds the discount amount to the total instead of subtracting it. What type of an error is this?. Answer: A logic error ⩥ Which one of the following methodologies is a sequence of steps formulated in English for solving a program?. Answer: Pseudocode
⩥ In order to run Java programs on a computer, the computer needs to have software called a(n). Answer: virtual machine ⩥ In order to translate a Java program to a class file, the computer needs to have software called a(n). Answer: compiler ⩥ The Java statement public static void main(String[] args) declares a. Answer: method ⩥ A Java virtual machine is. Answer: software ⩥ Which of the following statements must you include in a Java class that can be executed by the virtual machine?. Answer: public static void main(String[] args) ⩥ What is the output of the following code snippet? System.out.print("Hello"); System.out.println("Good Day!");. Answer: HelloGood Day! ⩥ Which one of the following code snippets compiles without errors and displays the output "Hello Good Day!" on the screen?. Answer: System.out.print("Hello ");
III. overcome the need for connectivity to the computer network. Answer: I, II ⩥ The ENIAC computer burned out transistors at the rate of. Answer: none -- it used vacuum tubes ⩥ In order for the ENIAC computer to be re-programmed. Answer: wires needed to be plugged into a different wiring configuration ⩥ The language developed by Sun Microsystems that became the Java programming language was originally designed to be simple, secure, and. Answer: usable for many different processor types ⩥ The term "applet" refers to. Answer: a Java program that runs within a web browser ⩥ Programmers have embraced Java over its closest rival, C++, mainly because. Answer: it is easier to use ⩥ Java is said to be a "safe" programming language. What does this mean?. Answer: Java programs can run within a browser without fear that they may attack your computer ⩥ In order for Java to achieve protability. Answer: compiled Java programs contain instructions for a virtual machine
⩥ A Java Virtual Machine is. Answer: a program that simulates a real CPU ⩥ The Java programming language is itself relatively simple, but also contains a vast set of. Answer: library packages ⩥ The source code for a Java program is stored in a file. Answer: that ends with a.java suffix ⩥ A Java "class" file. Answer: contains instructions to the Java virtual machine ⩥ 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. Answer: I, III ⩥ Which statements are true?
⩥ During program development, errors are. Answer: unavoidable ⩥ 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. Answer: I, II, III ⩥ Which of these are true about writing algorithms in pseudo code? I. The exact wording is not important II. The sequence of steps should be ambiguous III. The algoirthm should terminate. Answer: I, III ⩥ A sequence of steps that is unambiguous, executable, and terminating is called. Answer: an algorithm
⩥ The first step in describing an algorithm in pseudo code is. Answer: determine the inputs and outputs ⩥ 1) Which of the following loops executes the statements inside the loop before checking the condition? a) for b) while c) do d) do-for. Answer: Answer: c) do ⩥ 2) How many times will the following loop run? int i = 0; while (i < 10) { System.out.println(i); i++; } a) 0 b) 8
System.out.println ("Loop Execution"); i++; } a) Infinite times b) 8 times c) 9 times d) 10 times. Answer: Answer: c) 9 times ⩥ 5) What is the output of the code fragment given below? int i = 0; int j = 0; while (i < 27) { i = i + 2; j++; } System.out.println("j=" + j); a) j= b) j=
c) j= d) j=14. Answer: Answer: d) j= ⩥ 6) What is the output of the following code snippet? int i = 1; while (i < 10) { System.out.print(i + " "); i = i + 2; if (i == 5) { i = 9; } } a) 1 3 5 b) 1 3 9 c) 1 3 5 7 9 d) 1 3 5 9. Answer: Answer: b) 1 3 9