Computer Science > QUESTIONS & ANSWERS > CS 1102 Programming Unit 3 Graded Quiz with Answers- University of the People. 100% proven pass rate (All)

CS 1102 Programming Unit 3 Graded Quiz with Answers- University of the People. 100% proven pass rate.

Document Content and Description Below

The operation ++ in Java means - ✔✔That the value of 1 is added to the variable The rules that determine what is allowed in a program are known as the ____ of the language. - ✔✔syntax Va... riables 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 enum Season { SPRING, SUMMER, FALL, WINTER } ; Season vacation; vacation = Season.SUMMER; System.out.println(Season.SUMMER); - ✔✔SUMMER A statement with the following format variable1 = ( x>=2) ? x++ : x--; is employing a: - ✔✔conditional operator The fetch and execute cycles always alternate? - ✔✔True A computer is built to carry out instructions that are written in a simple type of language. - ✔✔True 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 A variable of type boolean in java can have precisely two literals. - ✔✔True An asynchronous event is one that occurs at an unpredictable time outside the control of the program that the CPU is running. - ✔✔True Java programs are NOT compiled. - ✔✔False One of the components of a computer is its CPU, which executes programs." - ✔✔True A name for a constant value in java is called a literal. - ✔✔True An enum (enumerated type) is a example of an object type instead of a primitive type? - ✔✔True Which of the following statements about the 'block' statement are true - ✔✔it groups a sequence of statements into a single statement What output will the following code produce: int number; number = 1; while ( number < 6) { System.out.print(number); number += 1; } - ✔✔12345 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"); } - ✔✔it is a infinite loop that will continue to loop forever (until the program is terminated) 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 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 A for loop can use a list structure such as an enum to iterate the for loop? - ✔✔True The break loop when encountered will cause processing to skip to the beginning of the loop? - ✔✔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 A for loop is used when the number of iterations through the loop in known in advance? - ✔✔True The while loop is used when a known, finite number of loop iterations is required. - ✔✔False The conditional expression in a while loop can be any expression that evaluates to a logical True or False? - ✔✔True The while loop repeats a set of code while the condition is false. - ✔✔False The do-while loop repeats a set of code at least once before the condition is tested. - ✔✔True The for loop continues while a condition is true, and it ends when that condition becomes false. - ✔✔True Can a for statement loop indefinitely? - ✔✔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? - ✔✔1 A "black box" has an interface and an implementation. Which of the following statements describe interface? - ✔✔The interface of a black box is its connection with the rest of the world, such as the name and parameters of a subroutine. What are formal parameters ? - ✔✔Formal parameters are found in the subroutine definition. The values of the actual parameters are assigned to the formal parameters before the body of the subroutine is executed. 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? - ✔✔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): - ✔✔displays 30 animation frames in order; 2) replays the animation 10 times. What are formal parameters ? - ✔✔Formal parameters are found in the subroutine definition. The values of the actual parameters are assigned to the formal parameters before the body of the subroutine is executed. 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 [Show More]

Last updated: 2 years ago

Preview 1 out of 45 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 )

$10.00

Buy Now

We Accept:

We Accept

Instant download

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

260
0

Document information


Connected school, study & course


About the document


Uploaded On

Aug 16, 2022

Number of pages

45

Written in

Seller


seller-icon
bundleHub Solution guider

Member since 3 years

356 Documents Sold

Reviews Received
27
21
9
0
9
Additional information

This document has been written for:

Uploaded

Aug 16, 2022

Downloads

 0

Views

 260

Document Keyword Tags

More From bundleHub Solution guider

View all bundleHub Solution guider's documents »

$10.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·