Coding

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following symbols is the "not equal" symbol? == not = != <>

!=

The purpose of a wrapper class is to Allow methods to be called on a primitive value "Wrap" an object to convert it to a primitive value Allow primitive to be passed to methods "Wrap" a primitive value to convert it to an object

"Wrap" a primitive value to convert it to an object

Which of the below is NOT a Java arithmetic operator? + - # /

#

Which of the following could be stored in the variable char initial; "k" 'karel' "karel" 'k'

'k'

What will this code segment output? public class Printing { public static void main(String[] args) { System.out.println("*****"); System.out.println("****"); System.out.println("***"); System.out.println("**"); System.out.println("*"); } }

***** **** *** ** *

What range of numbers would be generated by using int num = (int) (Math.random() * 501); 1 - 500 1 - 501 0 - 501 0 - 500

0 - 500

What will be stored in the variable modulo after running the following code snippet? public static void main(String[] args) { int num = 2; int modulo = 15; modulo %= num; } 1 2 15 This code will throw an error because the compound assignment operator is written incorrectly.

1

What would this program print? double sideLength = Math.sqrt(64); double height = Math.pow(3, 2); double difference = Math.abs(sideLength - height); System.out.println(difference); 1.0 -1.0 0.0 8.0

1.0

What is the result of this expression? 4 + 8 * 3 / 4 + 5 % 2 5 6 12 11

11

What will the following code print? int n = 5; n ++; n ++; n += n; System.out.println(n); 12 40 14 18

14

Given the following, what will be printed out? int a = 2; int b = 3; int c = 4; System.out.println(a * b + b / a + (a * c / 4.0) * c); 15.0 24 15 24.0

15.0

What will be stored in the variable age after this code snippet executes? public static void main(String[] args) { int age = 16; age++; age--; age++; } 16 17 15 This code will throw an error because age can only hold one value at a time.

17

What is the output of the following code snippet? String forest = "Amazon Rainforest"; System.out.println(forest.indexOf('a')); System.out.println(forest.indexOf('g')); System.out.println(forest.indexOf('n')); This will throw an error because 'g' is not in the string. 0 -1 5 1 0 6 2 -1 5

2 -1 5

Consider the Circle class below. public class Circle { private double radius; public Circle(double circleRadius) { radius = circleRadius; } public void setRadius(double newRadius) { radius = newRadius; } public void printDiameter() { double diameter = 2 * radius; System.out.println(diameter); } } What is the output of the main method below? public class MyProgram { public static void main(String[] args) { Circle pizza = new Circle(12); pizza.printDiameter(); pizza.setRadius(10); pizza.printDiameter(); } } 24.0 20.0 24.0 24.0 Nothing will print because the code contains an error. 24.0

24.0 20.0

How many lines will be printed with the following statement? System.out.println("Hello"); System.out.println(" World"); System.out.print("Welcome to"); System.out.print("Java."); 1 2 3 4

3

What will be the output of the following code snippet? public class Calculator { public static void main(String[] args) { int first = 7; int second = 2; int result = first / second; System.out.println(result); } } 3.5 3.50 3 3 1/2

3

What is the value of x after this code runs? int x = 5; x = 10; x = 4; 5 10 4 true

4

What is the result of the following expression when x is 125?x % 6 5 20 20.8 0.8

5

What is the value of myInteger after this line of code is executed? int myInteger = (int) 5.6; 6 5.6 5 9

5

What is the result of this expression? 150 % 100 0 100 50 3

50

What is the result of this expression? (int) (5 + 2 / 3 + 1) 5 6 6.67 7 0

6

The following code is intended to print 8. int x = 23; double y = 3; System.out.println((int)(x / y)); What is printed and why? 7 because the values of x and y are integers so 23 / 3 evaluated to 7 7 becausex / y calculates to 7.66 then the cast to an int results in the value getting truncated to 7 8 because the values of x and y are integers so 23 / 3 evaluated to 8 8 because x / y calculates to 7.66 then the cast to an int results in the value getting rounded up to 8

7 becausex / y calculates to 7.66 then the cast to an int results in the value getting truncated to 7

What will this java expression evaluate to? (int) 9.9 0 10 9 5

9

What is the difference between == and =? == is used for assignment, while = is used to check for equality. = is used for assignment, while == is used to check for equality. == assigns values to objects while = assigns values to primitives. There is no difference. These symbols can be used interchangeably.

= is used for assignment, while == is used to check for equality.

Which of the following is NOT a relational operator? < ? == >=

?

Java automatically converts between objects and primitives in the process of autoboxing and unboxing. What happens when a Double is unboxed? A Double is unboxed when it is converted to a primitive value. A Double is unboxed when it is converted to an Integer A Double is unboxed when it is passed to a method. A Double is unboxed when it is converted to a Double value.

A Double is unboxed when it is converted to a primitive value.

What is a constructor in Java? A constructor is something that holds the private state of an instance. A constructor allows us to create a new instance of a class, usually initializing instance variables. A constructor is a method with instructions on how to use a class. A constructor is a syntax rule in Java for placing curly brackets.

A constructor allows us to create a new instance of a class, usually initializing instance variables.

Java automatically converts between objects and primitives in the process of autoboxing and unboxing. What happens when an int is autoboxed? A int is autoboxed when it is converted to a primitive value. A int is autoboxed when it is converted to a Double A int is autoboxed when it is passed to a method. A int is autoboxed when it is converted to a Integer

A int is autoboxed when it is converted to a Integer

What would be printed by the following code snippet? String lastName = "Vu"; String otherLastName = "Lopez"; int comparison = lastName.compareTo(otherLastName); System.out.println(comparison); Zero because both strings start with capital letters A positive number because "Vu" comes before "Lopez" in lexicographical order. A negative number because "Vu" comes before "Lopez" in lexicographical order. A positive number because "Vu" comes after "Lopez" in lexicographical order. A negative number because "Vu" comes after "Lopez" in lexicographical order.

A positive number because "Vu" comes after "Lopez" in lexicographical order.

Which of these is not true about primitives and objects? An object stores an address as a value while a primitive stores a literal value. An object has data and methods associated with it while a primitive only stores data. When passed to a method, changes made to the object will show in the calling method, but changes to the primitive will not. A primitive has data and methods associated with it while an object only stores data.

A primitive has data and methods associated with it while an object only stores data.

Which code snippet below will end with num holding the value 15? public static void main(String[] args) { int num = 14; num++; num--; num++; } public static void main(String[] args) { int num = 225; num /= 15; System.out.println(num); } public static void main(String[] args) { int num = 31; num %= 16; System.out.println(num); } All of the above

All of the above

Which of the following is true about primitive types in Java? A variable is the name given to a memory location. The value stored in a variable can be changed during program execution. All variables must be declared before use. All of these statements are correct for primitive variables in Java.

All of these statements are correct for primitive variables in Java.

Which of the following statements will not compile? You may assume any text in this font is an initialized variable. I. "Tilly is " + age + " years old" II. "My favorite letter is " + 'k' III. greeting + name IV. "Our team, " + teamName + " has " + numPlayers III because you can't combine two variables I, II, III, IV because you can only concatenate two things at a time. I, IV because you can't combine Strings and numbers. All of these statements will compile

All of these statements will compile

What is an instance method? An instance method is a piece of code called on a specific instance (an object) of the class. An instance method is a piece of code that does not depend on any specific instances (objects), just on the general class. An instance method adds functionality to a class by creating private fields. An instance method adds functionality to the class by printing out a result.

An instance method is a piece of code called on a specific instance (an object) of the class.

What will be the output of the following code snippet? public class Casting { public static void main(String[] args) { int total = 100; int numPeople = 40; double average; average = total / (double) numPeople; System.out.println("Average: " + average); } } Average: 0.4 Average: 0.0 Average: 2.0 Average: 2.5

Average: 2.5

What does it mean to be a client of a class? Being a client of a class means that there a single method that we can use. Being a client of a class means that we are the author of the class implementation. Being a client of a class means that we can use its methods and functionality without necessarily understanding how it works. Being a client of a class means that the class has documentation.

Being a client of a class means that we can use its methods and functionality without necessarily understanding how it works.

What is casting in Java? What Karel does when she breaks her leg. Casting is turning a value of one type into another type. A way to get user input in Java. A way to print to the screen in Java.

Casting is turning a value of one type into another type.

Which of the following is NOT a valid way to overload this constructor? For brevity, only the signature is given. Pineapple(String color) Java Pineapple() Java Pineapple(String color, int age) Java Pineapple(int age, String species) Java FancyPineapple(String color, int age) Java

FancyPineapple(String color, int age) Java

What output will be produced by System.out.println("Hello"); System.out.println("Karel"); Hello Karel HelloKarel Hello Karel Error

Hello Karel

What will this code segment output? System.out.println("Hello"); System.out.println("World"); Hello World HelloWorld Hello World Hello World

Hello World

Which of the following would equal 2? I. int x = 0; x ++; x += x; II. int y = 4; y ++; y /= 2; III. int z = 4; z += 2; z /= 2; I Only II Only III Only I and II Only I, II, and III

I and II Only

Which of the following print: Hello Java! I. System.out.println("Hello Java!"); II. System.out.print("Hello Java!"); III. System.out.print("Hello"); System.out.print("Java!"); IV. System.out.println("Hello"); System.out.println("Java!"); I and II only I, II, and III only I and III only I, II, and IV only

I and II only

A financial planner wants to calculate the average rate of return for clients. She does this by dividing the earnedIncome by the principal amount and displays the value as a double. Which of the following will correctly calculate and store the returnRate, assuming earnedIncome and principal are integers? I. double returnRate = earnedIncome / principal;II. double returnRate = (double) earnedIncome / principal;III. double returnRate = (double) (earnedIncome / principal); I only II only III Only II and III only I, II, III

II only

What is the purpose of overloading a class' constructor? It allows the user to create more than one object from the class. It allows the user to make different types of objects from a single class type. It allows the user to set the values of different combinations of the instance variables when the object is created. It allows the user to call different constructors for the same object to initialize different instance variables.

It allows the user to set the values of different combinations of the instance variables when the object is created.

What is the output of this program? int phLevel = 9; if(phLevel < 7) { System.out.println("It is acidic!"); } if(phLevel > 7) { System.out.println("It is basic!"); } if(phLevel == 7) { System.out.println("It is neutral!"); } It is acidic! It is basic! It is neutral! It is acidic!It is basic!It is neutral!

It is basic!

What does the keyword final do? It's necessary to declare a variable. Enables the use of println on a variable. It prevents variables from being altered. It indicates that the program has finished executing.

It prevents variables from being altered.

What would be printed by this code snippet? String language = "Java"; String opinion = " is fun!"; System.out.println(language + opinion); Java Javais fun! Java is fun! This code would not compile. You can't add Strings.

Java is fun!

Which of these is an example of calling a static method? point.setX(x) Math.abs(x) student.getName() square(x)

Math.abs(x)

Strings are immutable. This means that Once a String variable has been assigned a value, the value of the variable must always have the same value. Once a String variable has been assigned a value, the value cannot be modified but the variable can be assigned to a different value. The value of a String variable can be modified, but the variable cannot be reassigned. The value of a String variable cannot be modified and the variable cannot be reassigned.

Once a String variable has been assigned a value, the value cannot be modified but the variable can be assigned to a different value.

What is the correct syntax for creating a Scanner object? Scanner = new Scanner; scanner object = new scanner(System.in); Scanner objectName = new Scanner(System.in); Scanner objectName = System.in;

Scanner objectName = new Scanner(System.in);

Which of the following describes the difference between static methods and instance methods? Static methods cannot return a value while instance methods may or may not return a value Static methods can be called without using an object while instance methods need to be called on an object A class can only have one static method. Static methods must be called using an object while instance methods can be called without using an object

Static methods can be called without using an object while instance methods need to be called on an object

Which of the choices below is not a primitive type in Java? int char boolean double String

String

Which of the following is not a primitive type? int double String boolean char

String

Which code segment will print "Hello Karel" to the screen in Java? System.out.printLine("Hello Karel"); print "Hello Karel"; Correct Answer System.out.println("Hello Karel"); System.println("Hello Karel");

System.out.println("Hello Karel");

Which of the following would properly print this quote by Edsger W. Dijkstra (an early pioneer of Computer Science) as shown below? "Testing shows the presence, not the absence of bugs" --- Edsger W. Dijkstra System.out.println('"Testing shows the presence, not the absence of bugs"'); System.out.println("--- Edsger W. Dijkstra"); System.out.println("Testing shows the presence, not the absence of bugs"); System.out.println("--- Edsger W. Dijkstra"); System.out.println("\"Testing shows the presence, not the absence of bugs\""); System.out.println("--- Edsger W. Dijkstra"); System.out.println(""Testing shows the presence, not the absence of bugs""); System.out.println("--- Edsger W. Dijkstra");

System.out.println("\"Testing shows the presence, not the absence of bugs\""); System.out.println("--- Edsger W. Dijkstra");

What are parameters? The value that a method returns. The values that a method prints to the screen. The formal names given to the data that gets passed into a method. The type that is given to a variable.

The formal names given to the data that gets passed into a method.

A reference variable holds a special value. What is this special value? The memory address of an object The memory address of the reference variable An object The name of an object

The memory address of an object

Which of the following statements is true about variables? The memory associated with a variable of a primitive type holds an actual primitive value. When a variable is declared final, its value can only be changed through a direct reassignment. A variable originally created as an int can be changed to store a double through casting. All of these choices are true

The memory associated with a variable of a primitive type holds an actual primitive value.

What will be the output of the following code snippet and why? public static void main(String[] args) { int num = 2; int dividend = 5; dividend /= num; System.out.println(dividend); } The output will be 2.5 because 5 divided by 2 is always 2.5. The output will be 2.0 because when two integers are divided in Java, the decimal portion is always truncated. The output will be 2 because when two integers are divided in Java, the decimal portion is always truncated. This code will throw an error because the variable dividend cannot store a double type in memory.

The output will be 2 because when two integers are divided in Java, the decimal portion is always truncated.

A Timer class is a class that represents a minute timer. A partial definition of the class is given below. public class Timer { private int length; public Timer(int duration) { length = duration; } public void endTime() { System.out.print("The timer will end in " ); System.out.print(length); System.out.println(" minutes"); } public void addFiveMinutes() { length = length + 5; } } Java What is the output of the following main method? public static void main(String[] args){ Timer muffins = new Timer(30); muffins.endTime(); muffins.addFiveMinutes(); muffins.endTime(); } Java The timer will end in 30 minutes The timer will end in 30 minutes The timer will end in 35 minutes The timer will end in 30 minutes The timer will end in 30 minutes This method won't print anything because it doesn't have any print statements.

The timer will end in 30 minutes The timer will end in 35 minutes

Consider the following code snippet. public static void main(String args[]){ final int z; z = 20; z = 30; System.out.println(z); } What value of z is actually printed? 20 30 This code gives an error. Nothing is printed.

This code gives an error.

Why do we use if statements in Java? To break out of some block of code To do something only if a condition is true To do something while a condition is true To repeat something for a fixed number of times

To do something only if a condition is true

Which of the following is NOT part of the constructor signature? Which instance variables are initialized The parameter types The order of the parameters The name of the constructor

Which instance variables are initialized

You are using a class as a client. What would you need to know in order to create an object of the class you intend to use? You need to know how the class you are a client of was implemented. You need to know the formal parameters in order to pass in actual parameters. You need to know what other programs are using the class as a client. You need to know the programmer who wrote the class.

You need to know the formal parameters in order to pass in actual parameters.

The value that a method outputs is called a print statement. an argument. a parameter. a return value.

a return value.

In Java, the = sign in a statement means is equal to. the left hand side is equal to the right hand side in the equation. an assignment of the right hand side value to the left hand side variable. that two equivalent relationships can be compared using a Boolean comparison.

an assignment of the right hand side value to the left hand side variable.

Which Java Data Type would be the best suited to represent whether or not a student has completed their homework? int double String boolean

boolean

Suppose you have a class called Elevator. The Elevator class has a method called goingUp, partially defined below public boolean goingUp() { // code omitted } Which of the following statements correctly stores the return value of goingUp when it is called on the Elevator object called hotel? int up = hotel.goingUp(); double up = hotel.goingUp(); boolean up = hotel.goingUp(); String up = hotel.goingUp();

boolean up = hotel.goingUp();

Which Java Data Type would be best suited to represent the amount of money in a bank account? double boolean int String

double

What is the difference between the int type and the double type? int can be assigned numbers like 1, 3, 3.5, -4, but double can only assign numbers like 1, 4, -7, 10. int can be assigned numbers like 1, 3, -4, but double can only assign numbers like 1.5, 2.25, -16.987. double can be assigned numbers like 1, 3, 3.5, -4, but int can only be assigned numbers like 1, 4, -7, 10. double can be assigned numbers like 1, 3, -4, but int can only assign numbers like 1.5, 2.25, -16.987.

double can be assigned numbers like 1, 3, 3.5, -4, but int can only be assigned numbers like 1, 4, -7, 10.

Refer to the following code segment: double myDouble = 1/4; System.out.println("1 / 4 = " + myDouble); The output of the code is: 1 / 4 = 0.0 The student wanted the output to be: 1 / 4 = 0.25 Which change to the first line of their code segment would get the student the answer that they wanted? int myDouble = 1/4; double myDouble = (double) 1/4; double myDouble = (int) 1/4; double myDouble = (int) (1.0/4.0);

double myDouble = (double) 1/4;

What is the proper syntax to declare and initialize a variable called temperature to have the value 70.4? int temperature = 70.4; double temperature = 70.4; temperature = 70.4; dbl temperature = 70.4; temperature = (double) 70.4

double temperature = 70.4;

Given a and b as properly initialized integers, which of the following will result in a correct calculation with a decimal answer? double y = (double) (a / b); double y = a / b * 1.0; double y = a / b; double y = 1.0 * a / b;

double y = 1.0 * a / b;

Consider the code snippet below. String name = "Karel"; String checkName = new String("Karel"); boolean nameMatches = name == checkName; Note that we forced Java to create a new String object by using new and calling the String constructor.Recall that if you set two String variables to the same String literal, Java tries to be efficient and uses the same object. With this in mind, what will the value of nameMatches be? true false Cannot be determined.

false

Which if statement is written properly? if (boolean expression): // code to execute // code to execute if boolean expression { // code to execute // code to execute } if(boolean expression) { // code to execute // code to execute } if boolean expression [ // code to execute // code to execute ]

if(boolean expression) { // code to execute // code to execute }

Consider the following code snippet. What would the output be? String school = "Rydell High School"; System.out.println(school.substring(8)); System.out.println(school); igh SchoolRydell High School gh SchoolRydell High School igh Schooligh School gh Schoolgh School ii

igh SchoolRydell High School

Which Java Data Type would be the best suited to represent the number of days left until the AP Computer Science Exam? double String int boolean

int

public class Rectangle { private int width; private int height; public Rectangle(int rectWidth, int rectHeight) { width = rectWidth; height = rectHeight; } public int getArea() { return width * height; } public int getHeight() { return height; } public int getWidth() { return width; } public String toString() { return "Rectangle with width: " + width + " and height: " + height; } } If a new variable Rectangle shape = new Rectangle(10, 20); was initialized, what is the correct syntax for retrieving the area of shape? int area = Rectangle.getArea(); int area = shape.getArea(); shape.getArea(10,20); Rectangle.getHeight() * Rectangle.getWidth(); shape.getArea();

int area = shape.getArea();

Joe's Pizza is creating a program that will calculate the total amount of money an employee earns each week. Employees are paid by the hour and only work in 1 hour increments. Salaries start at minimum wage, but employees get a $0.50 raise after the first month. Which variables would be the best to store the hours and salary of the employees? double hours int salary int hours double salary boolean hours double salary int hours int salary double hours boolean salary

int hours double salary

Which of the following is a proper way to declare and initialize a variable in Java? myInteger = 100; char = 'a'; int myNumber = 10; "Variable"

int myNumber = 10;

What is the correct line of code needed to request a whole number from a user? Assume a Scanner object called input has already been created. String num = input.nextInt(); int num = Integer.nextInt(); int num = input.nextDouble(); int num = input.nextInt();

int num = input.nextInt();

A teacher has calculated the gradeAverage as a double, but for report cards, she needs to report it rounded to the nearest whole number. Assuming that we round up from 0.5, which of the following will correctly round the gradeAverage? int rcGrade = (int) gradeAverage; int rcGrade = gradeAverage % 0.5; int rcGrade = (int) gradeAverage + 0.5; int rcGrade = (int) (gradeAverage + 0.5); int rcGrade = (int) gradeAverage - 0.5;

int rcGrade = (int) (gradeAverage + 0.5);

Suppose there is a class called Student. One of the methods is given below. It sets the instance variable isHonors to the parameter value. public void setHonorStatus(boolean status) { isHonors = status; } Using the Student object called karel, which of the following is the correct way to set karel's honor status to true? karel.setHonorStatus(isHonors = true); karel.isHonors = true; karel.setHonorStatus(status=true); karel.setHonorStatus(true);

karel.setHonorStatus(true);

Which of the following correctly calls the method addFiveMinutes on an object of the Timer class called kitchenTimer? kitchenTimer(addFiveMinutes); Timer.addFiveMinutes(); kitchenTimer.addFiveMinutes(); kitchenTimer.addFiveMinutes;

kitchenTimer.addFiveMinutes();

Suppose the class Timer has a method called startTime that prints out the starting time of the Timer.Which of the following correctly uses this method to print out the start time of a Timer object called laundry? System.out.println(laundry.startTime()); System.out.println(laundry.startTime); int start = laundry.startTime(); laundry.startTime(); laundry.startTime;

laundry.startTime();

What is the importance of the null value? null allows a reference variable to hold every object's address simultaneously. null prevents the reference variable from referring to another object again. null restricts the class to only making one object. null allows a reference variable to be empty and not hold any memory address.

null allows a reference variable to be empty and not hold any memory address.

Which of the following variable names follows best practices for naming a variable? 5apples someVariable applesnum Correct Answer numApples

numApples

Which of the following methods is implemented correctly with respect to the method's return type? public String getColor() { return "Red"; } public int getColor() { return "Red"; } public void getColor() { return "Red"; } public Color() { return "Red"; }

public String getColor() { return "Red"; }

What is the correct syntax for writing the main method in Java? public void main() { } public static void main() { } public static void main(String[] args) { } public static void String(main) { }

public static void main(String[] args) { }

Which of the following is a correctly written method for the class below? public class Timer { private int startMin; private int length; public Timer(int minute, int duration) { startMin = minute; length = duration; } public Timer(int duration) { startMin = 0; length = duration; } } Java public void addFiveMinutes() { length = length + 5; } Java public addFiveMinutes() { length = length + 5; } Java addFiveMinutes() { length = length + 5; } Java public void addFiveMinutes { length = length + 5; }

public void addFiveMinutes() { length = length + 5; }

Consider this code snippet that uses a class called Rectangle. int roomHeight = 40; int roomWidth = roomHeight * 3; Rectangle room = new Rectangle(roomHeight, roomWidth); Java Which of the following is a reference variable? room roomHeight roomWidth Rectangle

room

/** * The Shark class describes a shark. * * Every shark has a region where it lives and an age. * */ public class Shark { // Attributes private String habitat; private int age; public Shark(String region, int sharkAge) { habitat = region; age = sharkAge; } } Which of the following choices is a formal parameter of the constructor? habitat String Shark sharkAge

sharkAge

Refer to the Card class shown below. public class Card { private String suit; private int value; //13 values for each suit in deck (0 to 12) public Card (String cardSuit, int cardValue) { /* implementation */ } // Rest of the class goes here } Java Which of the following is the correct /* implementation */ code for the constructor in the Card class? cardSuit = suit; cardValue = value; Card = new Card (cardSuit, cardValue); Card = new Card (suit, value); suit = cardSuit; value = cardValue; suit = "Hearts"; value = 3;

suit = cardSuit; value = cardValue;

What method must a class implement in order to concatenate an object of the class with a String object? A constructor length toString print

toString

What does this Java expression evaluate to? 80 >= 80 "true" true false This expression will error

true

Which of the following values can correctly be saved in a boolean? True Yes 1 true yes

true

Which expression returns the 1's place of an integer x? x % 10 x / 10 x % 100 x + 1

x % 10

What will the output of the following lines of code be? int x = 10; int y = x / 4; System.out.print("x + y = "); System.out.print(x + y); x + y = 12 x + y = 12 x + y = 12.5 x + y = 12.5 x + y = 102

x + y = 12

What are the memory values associated with the variables x, y, and z after the code snippet below executes? int x = 7; double y = 2.0; boolean z = false; x = x + 3; z = true; x holds the int value 7, y holds the double value 2.0 and z holds the boolean value false. x holds the int value 10, y holds the double value 2.0 and z holds the boolean value true. This code snippet will result in a compile time error. x holds the int value 10, y holds the double value 2.0 and z holds the boolean value false. Answered

x holds the int value 10, y holds the double value 2.0 and z holds the boolean value true.

Assume y is a properly initialized positive integer. Which of the following will always result in a value of 1? y ++; y --; y += y; y /= y; y -= y;

y /= y;


Kaugnay na mga set ng pag-aaral

REITs, Commodities, & Retirement and Estate Planning

View Set

New Vehicle Detail, Storage and Delivery

View Set

NSC 290 1DL - AFR AMER PERSPECTIVES IN SCIENCE Midterm Exam Terms

View Set

Bio Unit 5 Module 2 Concept Resources

View Set

Chapter 15.2 Connect Questions - Concept, Comprehensive, and Conceptual Questions

View Set