Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Define these terms as they relate to Java Programming: a. Syntax b. Variable

ID: 3846328 • Letter: 1

Question

1. Define these terms as they relate to Java Programming: a. Syntax b. Variable c. CPU d. Case sensitive 2. Write assignment statements to perform the following calculations. Assume all variables are declared as doubles. a. Add 4 to jam and store the result in f b. Multiply mommy by 2 and store the result in jonny c. Divide f by 4.3 and store the result in f d. Subtract m from f and store the result in j 3. Modify the following code “snippet” to print out a blank line between each line of output not necessarily each line of Java code. System.out.println(“Hello dear Java student”); System.out.print(“I hope you get this right”); System.out.println(“This is tricky”); System.out.println(“The end”); 4. What does the following line of code do? final double e = 2.17; 5. Evaluate these expressions according to Java rules for arithmetic operator precedence and write the answer. Note all of these values are WHOLE NUMBERS. To receive partial credit, show your intermediate steps in determining an answer. a. 7 + 3 * 4 b. 3 + 11 % 3 – 2 c. (4 + 3) / 2 – 2 d. 7 – 2 * 4 + 1 6. What does this “code snippet” produce as output? int speed = 30; int time = 40; int distance = speed * time; System.out.println(“The distance is “ + distance); 7. Each different type of CPU has its own: A) Syntax B) Firmware C) Machine language D) Software 8. A computer program is: A) A set of instructions that enable the computer to solve a problem or perform a task B) Main memory C) Pseudocode D) A flow chart 9. Key words are: A) The data names in your program B) Words that have a special meaning in the programming language C) Symbols or words that perform operations on one or more operands D) Words or names defined by the programmer 10. Because Java byte code is the same on all computers, compiled Java programs: A) Must be re-compiled for each different machine it is run on B) Cannot run on Linux systems C) Are non-existent D) Are highly portable 11. When the + operator is used with strings, it is known as the: A) Assignment operator B) String concatenation operator C) Addition operator D) Combined assignment operator 12. Write a program to calculate the average of three test scores. Prompt the user for the three test scores. Each test score will be a whole number. The average should be calculated so that the average is displayed with a fractional part. My sample output is as follows: --------------------Configuration: -------------------- Enter first test score: 93 Enter second test score: 87 Enter third test score: 86 The average is: 88.66666666666667

Explanation / Answer

As per Chegg policy, I am answering four subparts of Question 1.

1.) a.) Syntax refers to the arrangement of lines of code so that it follows the rules of the given programming language. For example, you should declare variables before using them.

b.) Variable in programming language is given as the name of a memory location where a value of an identifier is stored.

c.) CPU plays a vital role in execution of a program as original program which are converted into machine code are executed by CPU and it also provides registers for different functions such as jump, load, store etc.

d.) Case sensitive means 'a' and 'A' both are different for the java compiler.

Hope it helps, feel free to comment in case of any query.