Computer Science > QUESTIONS & ANSWERS > CS 1102 FINAL prep All quizzes and answers. 100% Accurate answers. Rated A+ (All)

CS 1102 FINAL prep All quizzes and answers. 100% Accurate answers. Rated A+

Document Content and Description Below

True or False: A name for a constant value in java is called a literal. - ☑☑True True or False: An enum (enumerated type) is an example of an object type instead of a primitive type? - ☑☑Tr... ue Which of the following statements about the 'block' statement are true. Select one: a. it groups a sequence of statements into a single statement b. it conditionally executes a sequence of statements c. is use used to prevent a sequence of statements from being executed d. it is used to contain a main statement - ☑☑a What is the following java code structure known as: for (i=0; i<10; i++) { for (j=0; j<10; j++) { // do something } } - ☑☑nested loop Which statement is most valid regarding the following java code: while ( true ) { System.out.print("loop again"); } Select one: a. it is a infinite loop that will continue to loop forever (until the program is terminated) b. it is an iterative loop that ends when the conditional expression is false c. it is not valid java code d. none of the above - ☑☑a What will the following java code produce as output? int number; number = 1; while ( number < 6 ) { System.out.print(number); number = number + 1; } System.out.print("Done!"); - ☑☑12345Done! What will be the value of "x" if stringFunction is called as follows: String x = stringFunction("mississippi"); static String stringFunction(String str) { String test; int i; test = ""; for (i = str.length() - 1; i >= 0; i--) { test = test + str.charAt(i); } return (test); } - ☑☑ippississim An "animation" consists of a sequence of images shown rapidly one after the other on the computer screen. Each image in the animation is called a "frame." Suppose that you have a subroutine static void showFrame(int frameNum) that displays one frame in an animation. That is, showFrame(1) displays the first frame, showFrame(2) displays the second frame, and so on. Suppose that there are a total of thirty different frames. How many frames will the following code display?: for (int play = 0; play < 10; play++) { for (int i = 1; i < =30; i++) showFrame(i); } - ☑☑30 frames repeated 10 times True or False: A for loop can use a list structure such as an enum to iterate the for loop? - ☑☑True True or False: The break loop when encountered will cause processing to skip to the beginning of the loop? - ☑☑False True or False: The continue statement when used in a loop will cause the flow of process to skip to the end of the loop and begin another iteration of processing? - ☑☑True True or False: A for loop is used when the number of iterations through the loop in known in advance? - ☑☑True True or False: The while loop is used when a known, finite number of loop iterations is required. - ☑☑False True or False: The conditional expression in a while loop can be any expression that evaluates to a logical True or False? - ☑☑True True or False: The while loop repeats a set of code while the condition is false. - ☑☑False True or False: The do-while loop repeats a set of code at least once before the condition is tested. - ☑☑True True or False: The for loop continues while a condition is true, and ends when that condition becomes false. - ☑☑True True or False: Can a for statement loop indefinitely? - ☑☑True The operation ++ in Java means: - ☑☑1 is added to the variable The rules that determine what is allowed in a program are known as the ____ of the language. - ☑☑syntax Variables of the type short can have values in the range of: - ☑☑integers in the range -32768 and 32767 The size of a variable of type double is: - ☑☑8 bytes A language that generates a syntax error when you try to put a different data type into a variable that it has not be declared for is called a ________ language. - ☑☑strongly typed Which of the following is an object type? - ☑☑string What output will the following code produce: int x, y; boolean sameSign; x=1; y=1; sameSign = ((x>0)==(y>0)); System.out.println(sameSign); - ☑☑True A memory location that has been given a name is called a: - ☑☑variable Which of the following is NOT a primitive data type. - ☑☑String In Java, a variable of type long is ___ bytes in size. - ☑☑8 bytes (64 bits) A variable of type 'float' is represented in ___ bytes: - ☑☑4 bytes (32 bits) In java, a variable can only be used in a program if it has first been: - ☑☑declared Subroutines in Java are often referred to as: - ☑☑methods What output will the following code produce: int counter; counter = 5; counter += 1; System.out.println(counter); - ☑☑6 What output would the following code produce? enum Season { SPRING, SUMMER, FALL, WINTER } ; Season vacation; vacation = Season.SUMMER; System.out.println(Season.SUMMER); - ☑☑SUMMER A a statement with the following format variable1 = ( x>=2) ? x++ : x--; is employing: - ☑☑conditional operator True or False: The fetch and execute cycles always alternate? - ☑☑True True or False: A computer is built to carry out instructions that are written in a simple type of language. - ☑☑True True or False: A variable has a value that can not be changed by the program. - ☑☑False True or False: The word "public" when placed in front of a method declaration in java means that the routine can only be called from within the local class. - ☑☑False True or False: A variable of type boolean in java can have precisely two literals - ☑☑True True or False: An asynchronous event is one that occurs at an unpredictable time outside the control of the program that the CPU is running. - ☑☑True True or False: Java programs are NOT compiled. - ☑☑False True or False: One of the components of a computer is its CPU, which executes programs. - ☑☑True True or False: An enum (enumerated type) is a example of an object type instead of a primitive type? - ☑☑True Suppose that the first line of a subroutine definition is: static void test(int n, double x). Now consider these statements: test(17,42) test(0.17,3.227) Which of those statements is a legal subroutine call? Select one: a. Both 1 and 2 b. 1 c. 2 d. Neither 1 nor 2 - ☑☑1 A program contains a switch statement that lets you test the value of an expression and, depending on that value, to jump directly to some location within the switch statement. When compiling the program, when will a Java compiler report an error? - ☑☑If the value of the expression is a real number A "black box" has an interface and an implementation. Which of the following statements describe interface? Select one: a. The interface of a black box is its connection with the rest of the world, such as the name and parameters of a subroutine. b. The interface refers to internal workings of the black box. c. The interface is a parameter used by the program. d. None of the above - ☑☑The interface of a black box is its connection with the rest of the world, such as the name and parameters of a subroutine Here is the definition of the Pythagoras function: static double Pythagoras (double x, double y) { // Computes the length of the hypotenuse of a right // triangle, where the sides of the triangle are x and y. return Math.sqrt( x*x + y*y ); } Now, what is the result of the following statement: totalLength = 17 + Pythagoras (12,5); - ☑☑30 In which of the following examples can a NumberFormatException occur? Select one: a. When an attempt is made to convert a string into a number. b. In the valueOf function of an enumerated type. c. If an attempt is made to read from a file after all the data in the file has already been read. d. When TextIO.readfile is used to open a file that does not exist. - ☑☑When an attempt is made to convert a string into a number Consider the following subroutine: static void showFrame(int frameNum) Now study the following two statements 1) for (int i = 1; i <= 30; i++) showFrame(i); 2) for (int play = 0; play < 10; play++) { for (int i = 1; i <= 30; i++) showFrame(i); } Select the best description of statements 1) and 2): Select one: a. 1) displays 29 animation frames in reverse order; 2) replays the animation 10 times. b. 1) displays 30 animation frames in order; 2) replays the animation 10 times. c. 1) displays 29 animation frames in order; 2) replays the animation 9 times. d. 1) displays 31 animation frames; 2) replays the animation 10 times. - ☑☑displays 30 animation frames in order; 2) replays the animation 10 times The parameters in a subroutine definition are called: - ☑☑formal parameters What will the output of the following code be: int A=5; int N=3; int D; D = calcValue(A); System.out.println(D); static int calcValue( int N ) { int D; for( D=1; D<5; D++) { N++; } return(N); } - ☑☑9 What will the output of the following code be: int N=5; int D=4; int A=0; calcValue( N ) System.out.println(N); static void calcValue( int N ) { int D; for (D=0; D<5; D++) { N++; } } - ☑☑5 Consider the following statement: crt = new Circuit(); Which statement best describes the object that has been created? - ☑☑The variable crt refers to the object When the word public or private is added to a variable or subroutine definition these words are referred to as: - ☑☑Access Specifiers Examine the following class public class PatientRecord { public String lastname; // Patient's last name public int age; // Patient's age on admission public bool sex; // Indicates if patient is male or female } Initial values of lastname, age and sex instance variables will be: - ☑☑null, 0, false True or False: It is legal to have one subroutine physically nested inside another. - ☑☑False True or False: local variables are automatically initialized with a default variable where member variables are not. - ☑☑False [Show More]

Last updated: 2 years ago

Preview 1 out of 65 pages

Buy Now

Instant download

We Accept:

We Accept
document-preview

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

We Accept

Also available in bundle (1)

CS 1102 bundle, Questions with accurate answers. rated A+

4 different versions, rated A+ masterpieces

By bundleHub Solution guider 2 years ago

$18

4  

Reviews( 0 )

$12.00

Buy Now

We Accept:

We Accept

Instant download

Can't find what you want? Try our AI powered Search

116
0

Document information


Connected school, study & course


About the document


Uploaded On

Aug 16, 2022

Number of pages

65

Written in

Seller


seller-icon
bundleHub Solution guider

Member since 3 years

353 Documents Sold

Reviews Received
27
21
9
0
9
Additional information

This document has been written for:

Uploaded

Aug 16, 2022

Downloads

 0

Views

 116

Document Keyword Tags

More From bundleHub Solution guider

View all bundleHub Solution guider's documents »

$12.00
What is Scholarfriends

In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·