ITSC 1213 MAIN EXAMINATION QUESTIONS AND
ANSWERS SET A+
✔✔int - ✔✔> 4 bytes
> Integers in the range of -2,147,483,648 to +2,147,483,647
✔✔long - ✔✔> 8 bytes
> Integers in the range of -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
✔✔float - ✔✔> 4 bytes
> Floating-point numbers in the range of ±3.4 x 10-38 to ±3.4 x 1038, with 7 digits of
accuracy
✔✔double - ✔✔> 8 bytes
> Floating-point numbers in the range of ±1.7 x 10-308 to ±1.7 x 10308, with 15 digits of
accuracy
✔✔Variable Declarations take the following form: - ✔✔DataType VariableName;
✔✔Integers embedded into ___ are called ___ - ✔✔> Java source code
> integer literals
✔✔single precision - ✔✔> float
> 7 decimal points
✔✔double precision - ✔✔> double
> 15 decimal points
✔✔boolean - ✔✔> true/false
> can only be copied into another boolean
✔✔char - ✔✔> single character
> enclosed in single quotes ('\n')
,✔✔In order to store a value in a variable ___ - ✔✔you must use the assignment
operator (=)
✔✔The variables must be ___ before they can be used - ✔✔declared
✔✔Values assigned must be ___ with the variable's declared type. - ✔✔compatible
✔✔arithmetic operators - ✔✔(+) (-) (*) (/) (%)
✔✔division operator (/) - ✔✔divides two numbers and drops the remainder
✔✔modulus (%) - ✔✔divides twp numbers but only returns the remainder
✔✔operators are called binary operators because ___ - ✔✔they must have two
operands
✔✔the secret to java is ___ - ✔✔extreme vape
✔✔the second secret to java is ___ - ✔✔getting real thicc
✔✔Math class - ✔✔> contains methods that perform complex mathematical operations
Ex. Math.pow(number, power); and Math.sqrt(number)
✔✔combined assignment operators - ✔✔> (+=) (-=) (*=) (/=) (%=)
> allow the programmer to perform an arithmetic operation and assignment with a single
operator
✔✔Java is a ___ language - ✔✔strongly typed
✔✔Java performs some conversions between data types automatically, but does not
___ - ✔✔automatically perform any conversion that can result in the loss of data
✔✔widening conversion scale: - ✔✔Higher Rank^
> double
> float
> long
> int
> short
> byte
Lower Rank^
, ✔✔Storing values of higher-ranked data types into variables of lower-ranked type is
called ___. It will create a ___ error. - ✔✔> narrowing conversion
> compiler
✔✔cast operator - ✔✔> lets you manually convert a value, even if it means that a
narrowing conversion will take place
> consist of the destination type enclosed in ()
Ex. int x = (int) 4.20; x == 4
✔✔Cast operators can be used to avoid ___ - ✔✔> integer division
Ex. (x= 1/2; x==0) but (x = (double)1/2; x==0.5)
✔✔Constants - ✔✔> variables that can hold only a single value
> value cannot be modified once initialized
> declared using the keyword final
> all upper case and words are separated by the underscore character
Ex. final int CAL_SALES_TAX = 0.725;
✔✔Java has no primitive data type that ___ - ✔✔holds a series of characters
✔✔String class - ✔✔> class variable, not a primitive type
> capital S
> enclosed in double quotes ""
> is a class, so it shares their TitleCase naming conventions
> must reference a String object
✔✔how do primitive variables store values? - ✔✔they store values in the memory
location associated with themselves
✔✔how do class variables store values? - ✔✔they only hold the memory addresses of
the objects that contain their values
✔✔reference / pointer - ✔✔the memory address of the object that contains a value
✔✔variable can be assigned a ___ - ✔✔> String literal
> only works with Strings
> String value = "Hello";
> doesn't need to use the "new" keyword to create another object
✔✔3 methods for commenting Java code - ✔✔(//) (/* words */) (/** words*/)
ANSWERS SET A+
✔✔int - ✔✔> 4 bytes
> Integers in the range of -2,147,483,648 to +2,147,483,647
✔✔long - ✔✔> 8 bytes
> Integers in the range of -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
✔✔float - ✔✔> 4 bytes
> Floating-point numbers in the range of ±3.4 x 10-38 to ±3.4 x 1038, with 7 digits of
accuracy
✔✔double - ✔✔> 8 bytes
> Floating-point numbers in the range of ±1.7 x 10-308 to ±1.7 x 10308, with 15 digits of
accuracy
✔✔Variable Declarations take the following form: - ✔✔DataType VariableName;
✔✔Integers embedded into ___ are called ___ - ✔✔> Java source code
> integer literals
✔✔single precision - ✔✔> float
> 7 decimal points
✔✔double precision - ✔✔> double
> 15 decimal points
✔✔boolean - ✔✔> true/false
> can only be copied into another boolean
✔✔char - ✔✔> single character
> enclosed in single quotes ('\n')
,✔✔In order to store a value in a variable ___ - ✔✔you must use the assignment
operator (=)
✔✔The variables must be ___ before they can be used - ✔✔declared
✔✔Values assigned must be ___ with the variable's declared type. - ✔✔compatible
✔✔arithmetic operators - ✔✔(+) (-) (*) (/) (%)
✔✔division operator (/) - ✔✔divides two numbers and drops the remainder
✔✔modulus (%) - ✔✔divides twp numbers but only returns the remainder
✔✔operators are called binary operators because ___ - ✔✔they must have two
operands
✔✔the secret to java is ___ - ✔✔extreme vape
✔✔the second secret to java is ___ - ✔✔getting real thicc
✔✔Math class - ✔✔> contains methods that perform complex mathematical operations
Ex. Math.pow(number, power); and Math.sqrt(number)
✔✔combined assignment operators - ✔✔> (+=) (-=) (*=) (/=) (%=)
> allow the programmer to perform an arithmetic operation and assignment with a single
operator
✔✔Java is a ___ language - ✔✔strongly typed
✔✔Java performs some conversions between data types automatically, but does not
___ - ✔✔automatically perform any conversion that can result in the loss of data
✔✔widening conversion scale: - ✔✔Higher Rank^
> double
> float
> long
> int
> short
> byte
Lower Rank^
, ✔✔Storing values of higher-ranked data types into variables of lower-ranked type is
called ___. It will create a ___ error. - ✔✔> narrowing conversion
> compiler
✔✔cast operator - ✔✔> lets you manually convert a value, even if it means that a
narrowing conversion will take place
> consist of the destination type enclosed in ()
Ex. int x = (int) 4.20; x == 4
✔✔Cast operators can be used to avoid ___ - ✔✔> integer division
Ex. (x= 1/2; x==0) but (x = (double)1/2; x==0.5)
✔✔Constants - ✔✔> variables that can hold only a single value
> value cannot be modified once initialized
> declared using the keyword final
> all upper case and words are separated by the underscore character
Ex. final int CAL_SALES_TAX = 0.725;
✔✔Java has no primitive data type that ___ - ✔✔holds a series of characters
✔✔String class - ✔✔> class variable, not a primitive type
> capital S
> enclosed in double quotes ""
> is a class, so it shares their TitleCase naming conventions
> must reference a String object
✔✔how do primitive variables store values? - ✔✔they store values in the memory
location associated with themselves
✔✔how do class variables store values? - ✔✔they only hold the memory addresses of
the objects that contain their values
✔✔reference / pointer - ✔✔the memory address of the object that contains a value
✔✔variable can be assigned a ___ - ✔✔> String literal
> only works with Strings
> String value = "Hello";
> doesn't need to use the "new" keyword to create another object
✔✔3 methods for commenting Java code - ✔✔(//) (/* words */) (/** words*/)