175k views
5 votes
EXTRA POINTS!!!! PLEASE GIVE GOOD ANSWERS!!!

When comparing the comparison operator “equal” to the Java assignment operator, what is the main difference?

The comparison operator is == and the Java assignment operator is =.
The comparison operator is = and the Java assignment operator is ==.
The comparison operator is =+ and the Java assignment operator is =.
The comparison operator is = and the Java assignment operator is =+.
------------------------------------------

Which term best represents the set of rules that govern the use of words and punctuation in a language?

order of operations
variable
syntax
code
------------------------------

You are declaring a variable that will store text. Which data type could be used for the new variable? Choose the best answer.

Boolean
string
int
real
------------------------------------

Analyze the following code, which is correct for a conditional operator?

(myAge>=yourAge)?myAge-yourAge:yourAge-myAge
(myAge>=yourAge):myAge-yourAge:yourAge-myAge
(myAge>=yourAge)?myAge-yourAge?yourAge-myAge
(myAge>=yourAge);myAge-yourAge;yourAge-myAge
-----------------------------

Which of the following characters is not allowed for Java variable names?

backslash
dollar sign
capital A
underscore
-----------------------------------

You purchase moving boxes and mark them with labels to indicate the contents they will store. Which action describes the labeling of the boxes?

declaring variables
allocating memory
writing a program
compiling code
----------------------------------------

Which of the following symbols would not be seen in the syntax for Java variables, methods, or arguments?

{}
()
??
[]
--------------------------------

Which comparison operator is used for “not equal to”?

!=
%=
#=
*=
------------------------------

Why would you not use a char to store the phrase “Super100”?

A char only stores uppercase letters from A to Z.
A char only stores lowercase letters from a to z.
A char only stores one letter, number, or symbol.
A char only stores uppercase and lowercase letters.
-----------------------------------

What does the Boolean data type store?

0s or 1s
letters
numbers
colors
---------------------------

You are writing a payroll program in Java that needs to assign the value of 25 percent as a tax rate. Which statement represents the best construct of this assignment?

int taxRate == 0.25;
float taxRate = 0.25;
float taxRate != 0.25;
long taxRate = 25;
------------------------------------------

You are writing a program that needs to calculate gross pay for an employee based on variables grossPay, payRate, and hrsWorked. Which statement represents the best construct of this assignment?

grossPay = payRate – hrsWorked;
grossPay = payRate / hrsWorked;
grossPay = payRate – hrsWorked;
grossPay = hrsWorked * payRate;
---------------------------------

Which operation comes before D in PEMDMAS?

modulus
multiplication
addition
subtraction
---------------------------------

Which Java syntax describes the mathematical expression “3 is not equal to 9”?

3<>9
3!=9
3==9
3 not=9
---------------------------------

Which data type can be used to store decimal numbers in Java?

short
byte
float
int

2 Answers

4 votes
== is comparision
= is assignment

Syntax

String

(myAge>=yourAge)?myAge-yourAge:yourAge-myAge

Backslash

Declaring variables

??

!=

A char only stores one letter, number, or symbol

0s or 1s

float taxRate = 0.25;

grossPay = hrsWorked * payRate;

Multiplication

3!=9

float
User Austen Holmes
by
6.7k points
6 votes

Answer:

Equal to comparison operator is ==

The Assignment operator is =

Syntax

String

(myAge>=yourAge)?myAge-yourAge:yourAge-myAge

Backslash

Declaring variables

??

!=

A char only stores one letter, number or symbol

0s or 1s

float taxRate = 0.25;

grossPay = hrsWorked * payRate;

Multiplication

3!=9

Float

Step-by-step explanation:

The assignment operator is used for assigning values to a variable e.g x = 5 and y = 5, while the comparison operator is used to check if two variables are equal to each other e.g if x == y

String is used for text variables, boolean is used for 0s or 1's, int and float are used for numbers

Variable names in Java can begin with underscore, dollar sign or a letter but never a backslash. If you start your variable name with a backslash, it won't be recognized by the system

Declaring variables means declaring its type which is synonymous with what is being done, by labelling the boxes, you are defining the type of content they can hold

The ! sign is used for negation, therefore having it before an equal to symbol means that it negates the equal to

A char (character) only holds one single character, be it a number, letter or symbol. Super100 can be stored using a string instead

Boolean data types store 0s or 1s otherwise called no or yes respectively

Payment is always calculated based on hours worked and the pay rate, therefore, grossPay = hrsWorked * payRate is the best construct here

Multiplication comes before the Division, the other M stands for Modulus which is what you have left after performing a division

As stated above, the ! sign is used for negation, therefore for 3 not to equal 9, you have 3!=9

Float is used for decimal numbers in Java

User Dtg
by
6.7k points