EXAM UPDATED WITH COMPLETE QUESTIONS AND CORRECT
ANSWERS// VERIFIED/GRADED A+/
What kind error occurs when you use the wrong formula to
calculate the area of a circle?
Logic error. This is because the machine compiles and has a
valid value, but the answer is not correct because of the
equation in the program.
What kind of error occurs when you misspell a Java keyword
or forget a semicolon?
Compiler error. This is because there is an error in syntax.
What kind of error occurs when you try to send a Bug outside
of a grid in GridWorld?
Runtime error. A program has to do 2 things when it is run by
the user, compile and run. When moving the bug, it gives a
value and passes through the compiler. The value is
technically valid because it is a coordinate, so that means the
compiler can let it pass through. This can happen when you put
in a correct value, but it is out of the range of possible values.
Imagine going to the grocery store and you want to go to aisle
6, but there are only 5 aisles. You can head towards "aisle 6"
thinking it exists, but once you get there you realize it's not a
valid value. Basically, it is a logical value, but is it not possible
to get to.
Page 1 of 21
,When you compile your Java program, what is produced
besides the output?
A bytecode file. The *.class file is bytecode. It is not directly
executable. It is translated by the JVM at runtime.
What are some examples of primary memory?
RAM (Random Access Memory). It is volatile, so if the power
shuts off, the memory stored within it is not saved.
What are some examples of secondary memory?
Hard drive, CD-ROM, Flash drive, etc. These do not need power
in order to continue to store memory.
What are some examples of high-level languages?
Java, Pascal, C++, COBOL, Fortran, etc.
What are some examples of low-level languages?
Assembly language, machine code
Page 2 of 21
, What is the numeric value of the following expression?
Math.min(Math,pow(2,3),7)
7
First, it will call Math.pow, which values to 2^3 which values to
8. 8 is bigger than 7, so 7 is the min.
Operators
Which is the hexadecimal representation of the binary number
0010 110 1011 1111?
2CBF
Each 4 digit binary number translates to a single hexadecimal
digit. Any value higher than 9 will result in an uppercase letter
starting from A.
What are the binary numbers up to the 8th place value?
128 64 32 16 8 4 2 1
You can solve this for any amount of place values by using the
equation 2^n, where n is the place value. You start with 0 and
work your way up to the last place value. This works for other
bases such as base 4 as well, just replace the 2 with the new
base number.
Page 3 of 21