Docsity

Computer Engineering Final Exam Review Questions and Answers, Exams of Computer Engineering and Programming

Toggle sidebar
bg1
Computer Engineering Final Exam
Review Question and Answer
_____ data types include numbers (both integer and floating-
point), characters, and Boolean. - ANSPrimitive
_____ errors occur when a program asks the computer to do
something that it considers illegal, such as dividing by 0. -
ANSRun-time
_____ have higher precedence than _____. - ANSMultiplication and
division; addition and subtraction
_____ is the name of an object that knows how to display or print
characters in a terminal window. - ANSSystem.out
_____ is/are usually reserved for critical system programs that are
used when the computer starts up and are retained when the
computer is shut down. - ANSROM
_____ variables can be declared in a method to provide temporary
working storage for data in that method. - ANSLocal
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Computer Engineering Final Exam Review Questions and Answers and more Exams Computer Engineering and Programming in PDF only on Docsity!

Computer Engineering Final Exam

Review Question and Answer

_____ data types include numbers (both integer and floating- point), characters, and Boolean. - ANSPrimitive _____ errors occur when a program asks the computer to do something that it considers illegal, such as dividing by 0. - ANSRun-time _____ have higher precedence than _____. - ANSMultiplication and division; addition and subtraction _____ is the name of an object that knows how to display or print characters in a terminal window. - ANSSystem.out _____ is/are usually reserved for critical system programs that are used when the computer starts up and are retained when the computer is shut down. - ANSROM _____ variables can be declared in a method to provide temporary working storage for data in that method. - ANSLocal

A _____ is the smallest unit of information processed by a computer. - ANSbit A bit contains of eight adjacent bytes. - ANSFalse A variable declared with the keyword _____ will be a constant. - ANSfinal A while loop terminates immediately when a break statement is encountered, but a for loop does not. - ANSFalse A(n) _____ user interface uses the Java console and the command prompt to display data, prompt the user for data, and read data into a program. - ANSterminal I/O An assignment statement has the form _____. - ANS = An object has _____ as defined by the methods of its class. - ANSbehavior

Every object has its own unique identity. - ANSTrue For a programmer, machine-language coding is fast and efficient.

  • ANSFalse Helper methods are usually public. - ANSFalse if (sales >= 5000) commission = sales * 1; else if (sales >= 10000) commission = sales * 2; else if (sales >= 15000) commission = sales * 3 If sales has a value of 15,000, what will the final value of commission be? - ANS15, if (x > 5) if (y < 10) System.out.print("1");

System.out.print("2"); else System.out.print("3"); Assuming that x had a value of 10 and y has a value of 5, the output of this code fragment would be? - ANSNothing. The code would not compile. If a method has a return type, its implementing code must have at least one _____ statement that returns a value of that type. - ANSreturn In general, instantiation takes the form _____. - ANSSomeClass someObject = new SomeClass (Some parameters); In object oriented programming, a program is comprised of different types of software components called _____. - ANSclasses In the ASCII character encoding scheme, each character is represented by two bytes. - ANSFalse

Java's increment operator is represented by the symbol _____. - ANS++ Java's OR operator is represented by the symbol _____. - ANS| | Messages that change an object's state are called _____. - ANSmutators Strings can be concatenated to numbers. - ANSTrue Suppose a Student class contains a method setName to set the value of a Student object's - ANSA System.out.print("Enter a positive integer: "); int n = reader.nextInt(); int limit = n / 2; for (int d = 2; d <= limit; d++){ if (n % d == 0)

System.out.print(d + " "); If the user enters the number 12 when prompted, the output displayed to the console will be _____. - ANS2, 3, 4, 6 The _____ class contains a number of methods that can be used to perform mathematical operations. - ANSMath The _____ of a variable is the period during which it can be used. - ANSlifetime The ASCII character encoding scheme is able to encode _____ individual characters. - ANS The combining of data and behavior into a single software package is called _____. - ANSencapsulation The condition in an if statement must be a(n) _____ expression. - ANSBoolean The decimal number 3 is represented in binary as _____. - ANS

The statement a += 3; is equivalent to the statement a = a + 3; - ANSTrue The statements in a while loop will always execute at least once. - ANSFalse Translation from and high-level language to machine language is done by a program called a(n) _____. - ANScompiler What code snippets will display the square roots of 25, 20, 15, and 10? - ANSc. int number = 25; while (number >= 10) { System.out.println("The square root of " + number + " is " + Math.sqrt (number)); number -= 5; What is the proper structure of a for loop? - ANSfor (initialize counter; test counter; update counter){ statement; statement;

What is the sequence that correctly identifies the order of phases in the waterfall model? - ANSanalysis, design, implementation, integration, maintenance What Java statement would print the text "Hello" in a terminal window? - ANSSystem.out.println("Hello"); When a syntax error is found by the Java compiler, the error message that is provided yields no information about the type of error that occurred or where it occurred. - ANSFalse When an object is instantiated, it gets a complete set of fresh instance variables. - ANSTrue Which of the following is a valid variable name? a. 3rdPayment b. $$$$ c. pay.rate