GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Consider the following code segment. int x = 3;int y = -1;if…

Consider the following code segment. int x = 3;int y = -1;if (x – 2 > y){ x -= y;}if (y + 3 >= x){ y += x;}System.out.print(“x = ” + x + ” y = ” + y); What is printed as a result of the execution of the code segment?

Read Details

What is the output of the following code fragment? Assume al…

What is the output of the following code fragment? Assume all the variables are declared.   if(( 5.2 > 3.3 && 6.2 < 9.9) && (6.2 < 3.5 || 4.2 == 3.1 || 3.1 != 3.14)) {       System.out.print("TRUE");}else {     System.out.print("FALSE");}

Read Details

Consider the following code segment. System.out.print(“*”);…

Consider the following code segment. System.out.print(“*”);System.out.println(“**”);System.out.println(“***”);System.out.print(“****”); What is printed as a result of executing the code segment?

Read Details

A store sells rope only in whole-foot increments. Given thre…

A store sells rope only in whole-foot increments. Given three lengths of rope, in feet, the following code segment is intended to display the minimum length of rope, in feet, that must be purchased so that the rope is long enough to be cut into the three lengths. For example, for lengths of 2.8 feet, 3 feet, and 5 feet, the minimum length of rope that must be purchased is 11 feet. For these values, the code segment should display 11. As another example, for lengths of 1.1 feet, 3.2 feet, and 2 feet, the minimum length of rope that must be purchased is 7 feet. For these values, the code segment should display 7. In the following code segment, len1, len2, and len3 are properly declared and initialized double variables representing the three lengths of rope. double total = len1 + len2 + len3; int minLength = (int) (total + 0.5); System.out.print(minLength); Which of the following best describes the behavior of the code segment?

Read Details

Consider the three code segments. What is the output of the…

Consider the three code segments. What is the output of the programs? Block-Based Pseudo-Code   The pseudocode initializes list with values. It inserts 99 at positions 2, 3, and 4. A FOR EACH loop then displays every item in the updated list. Python Program-Code list = [11,22,33,44,55]list.insert(1,99)list.insert(2,99)list.insert(3,99)for item in list: print(item,end=” “) Text-Based Pseudo-Code list ← [11,22,33,44,55]INSERT (list, 2, 99)INSERT (list, 3, 99)INSERT (list, 4, 99)FOR EACH item IN list{ DISPLAY (item)}

Read Details

The volume of a cylinder is equal to the height times the ar…

The volume of a cylinder is equal to the height times the area of the circular base. The area of the circular base is equal to π (pi) times the square of the radius.   The following code segment is intended to compute and print the volume of a cylinder with radius r and height h. Assume that the double variables r, h, and pi have been properly declared and initialized.   /* missing code */ System.out.print(volume);   Which of the following cannot be used to replace /* missing code */ so that the code segment works as intended?

Read Details

In symmetric-key encryption, who has access to the key? 

In symmetric-key encryption, who has access to the key? 

Read Details

Consider the following code segment. boolean a = true; boole…

Consider the following code segment. boolean a = true; boolean b = false; boolean temp = a;a = b;b = temp;System.out.println(a);System.out.println(b); What is printed as a result of executing this code segment?

Read Details

Consider the following code segment, which uses properly dec…

Consider the following code segment, which uses properly declared and initialized int variables x and y and the String variable result.     String result = “”; if (x < 5){ if (y > 0) { result += “a”; } else { result += “b”; }}else if (x > 10){ if (y < 0) { result += "c"; } else if (y < 10) { result += "d"; } result += "e";}result += "f";     What is the value of result after the code segment is executed if x has the value 15 and y has the value 5?

Read Details

Assume that you are given the following declarations: int nu…

Assume that you are given the following declarations: int num = 0;double val = 0.0;num = 9 % 6 / 4 – 4; Show the value that will be stored in the variable on the left. If the expression causes an error, just type ‘error.’

Read Details

Posts pagination

Newer posts 1 … 31 32 33 34 35 … 86,419 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top