CSC FINAL EXAM QUESTIONS AND
ANSWERS
What is the difference between a compiler and an assembler?
STAGE 1 CONTENT QUESTION - ANSWER-An assembler translate assembly lines of
codes like add() push() etc into direct elating machine code. The commands relate
directly to a specific machine code usually with assembly language.
A compiler translates high level language program into machine code, and the code can
work on different types of machine code.
EX: Assembler is like a one to one translator (English - > Spanish) while a compiler can
translate to multiple languages (English -> Dutch, English -> Spanish, English -> Latin,
etc)
What is the difference between interpreted and compiled language?
STAGE 1 CONTENT QUESTION - ANSWER-Interpreted language the code is NOT
per-compiled and the code is compiled and translated as the program runs.
Compiled Language the code is per-compiled before the program runs.
How does the Java Virtual Machine change the way object code is executed?
STAGE 1 CONTENT QUESTION - ANSWER-The JVM runs Java Byte code, which is
compiled from high level language code. It allows for less porting to specific machines
as the code runs on a JVM and then the JVM translates it to any machine code.
How doe we declare a variable
STAGE 1 CONTENT QUESTION - ANSWER-<type> <name> = <value>;
int myAge = 19;
What do we mean by "type" of a variable?
STAGE 1 CONTENT QUESTION - ANSWER-The type means what information the
value will store or how much information the value will store.
int store whole numbers doubles stores a value between -2million something to 2 million
something
,double stores an int with higher precision
etc etc.
What is an assignment statement?
STAGE 1 CONTENT QUESTION - ANSWER-An assignment statement is the
statement that stores a value into a variable.
x = 5; is an example
int x = 5; combines the declarement statement and assignment statement
Explain what this code accomplishes:
x = x + 1;
STAGE 1 CONTENT QUESTION - ANSWER-Adds 1 to the value of x.
Explain why we read the = sign as "gets the value" versus "is equal to"
STAGE 1 CONTENT QUESTION - ANSWER-Because you are passing values into the
expression, and when you look at statements such as this...
int x = 5;
x = x + 5;
It doesn't mean 5 = 10, it means x that used to hold 5 now holds the value of 10 or x
gets the value of 10.
Does the order of the operands in an assignment statement matter? Why or why not?
STAGE 1 CONTENT QUESTION - ANSWER-Yes because the computer evaluates the
right hand side and then stores the value of that side into the left hand side.
What is the purpose of a while statement?
STAGE 1 CONTENT QUESTION
LAB 1 QUESTION - ANSWER-A while statement is a loop that loops through until a
certain condition is no longer true.
int x = 0;
while (x >= 5)
{
x = x + 1;
}
, Explain what the code int i; does
LAB 1 QUESTION - ANSWER-Declares a variable named i whose type is an int.
What is the purpose of breakpoints?
LAB 1 QUESTION
EXAM 1 QUESTION - ANSWER-A breakpoint is placed on a line in the code so the
debugger knows to stop there and go through step by step of the program so the
programmer can determine the problem with the program.
How do you set a breakpoint?
LAB 1 QUESTION - ANSWER-To set a breakpoint, simply click on the blue line to the
left of the code block in Eclipse
What is the difference between debug as and run as?
LAB 1 QUESTION - ANSWER-Run as runs the program not stopping and performs the
task
Debug as runs the program but stops at breakpoints to go through step by step to help
the programmer debug their code
What is a debugger and how do you use it to watch what your code is doing?
LAB 1 QUESTION - ANSWER-A debugger is a tool in the compiler that allows us to run
through the program step by step to determine what is wrong with our program.
Algorithm
STAGE 1 VOCAB - ANSWER-A sequential set of steps that will always find the correct
solution to a problem
Assembler
STAGE 1 VOCAB - ANSWER-A piece of software that translates programs written in an
assembly language into the language of a target machine.
Assembly language
STAGE 1 VOCAB - ANSWER-A programming language where one statement in the
language translates to exactly one statement of machine code
Assignment statement
STAGE 1 VOCAB - ANSWER-A Java statement that stores a value into a variable.
<type> <name> = <value>
Breakpoint
ANSWERS
What is the difference between a compiler and an assembler?
STAGE 1 CONTENT QUESTION - ANSWER-An assembler translate assembly lines of
codes like add() push() etc into direct elating machine code. The commands relate
directly to a specific machine code usually with assembly language.
A compiler translates high level language program into machine code, and the code can
work on different types of machine code.
EX: Assembler is like a one to one translator (English - > Spanish) while a compiler can
translate to multiple languages (English -> Dutch, English -> Spanish, English -> Latin,
etc)
What is the difference between interpreted and compiled language?
STAGE 1 CONTENT QUESTION - ANSWER-Interpreted language the code is NOT
per-compiled and the code is compiled and translated as the program runs.
Compiled Language the code is per-compiled before the program runs.
How does the Java Virtual Machine change the way object code is executed?
STAGE 1 CONTENT QUESTION - ANSWER-The JVM runs Java Byte code, which is
compiled from high level language code. It allows for less porting to specific machines
as the code runs on a JVM and then the JVM translates it to any machine code.
How doe we declare a variable
STAGE 1 CONTENT QUESTION - ANSWER-<type> <name> = <value>;
int myAge = 19;
What do we mean by "type" of a variable?
STAGE 1 CONTENT QUESTION - ANSWER-The type means what information the
value will store or how much information the value will store.
int store whole numbers doubles stores a value between -2million something to 2 million
something
,double stores an int with higher precision
etc etc.
What is an assignment statement?
STAGE 1 CONTENT QUESTION - ANSWER-An assignment statement is the
statement that stores a value into a variable.
x = 5; is an example
int x = 5; combines the declarement statement and assignment statement
Explain what this code accomplishes:
x = x + 1;
STAGE 1 CONTENT QUESTION - ANSWER-Adds 1 to the value of x.
Explain why we read the = sign as "gets the value" versus "is equal to"
STAGE 1 CONTENT QUESTION - ANSWER-Because you are passing values into the
expression, and when you look at statements such as this...
int x = 5;
x = x + 5;
It doesn't mean 5 = 10, it means x that used to hold 5 now holds the value of 10 or x
gets the value of 10.
Does the order of the operands in an assignment statement matter? Why or why not?
STAGE 1 CONTENT QUESTION - ANSWER-Yes because the computer evaluates the
right hand side and then stores the value of that side into the left hand side.
What is the purpose of a while statement?
STAGE 1 CONTENT QUESTION
LAB 1 QUESTION - ANSWER-A while statement is a loop that loops through until a
certain condition is no longer true.
int x = 0;
while (x >= 5)
{
x = x + 1;
}
, Explain what the code int i; does
LAB 1 QUESTION - ANSWER-Declares a variable named i whose type is an int.
What is the purpose of breakpoints?
LAB 1 QUESTION
EXAM 1 QUESTION - ANSWER-A breakpoint is placed on a line in the code so the
debugger knows to stop there and go through step by step of the program so the
programmer can determine the problem with the program.
How do you set a breakpoint?
LAB 1 QUESTION - ANSWER-To set a breakpoint, simply click on the blue line to the
left of the code block in Eclipse
What is the difference between debug as and run as?
LAB 1 QUESTION - ANSWER-Run as runs the program not stopping and performs the
task
Debug as runs the program but stops at breakpoints to go through step by step to help
the programmer debug their code
What is a debugger and how do you use it to watch what your code is doing?
LAB 1 QUESTION - ANSWER-A debugger is a tool in the compiler that allows us to run
through the program step by step to determine what is wrong with our program.
Algorithm
STAGE 1 VOCAB - ANSWER-A sequential set of steps that will always find the correct
solution to a problem
Assembler
STAGE 1 VOCAB - ANSWER-A piece of software that translates programs written in an
assembly language into the language of a target machine.
Assembly language
STAGE 1 VOCAB - ANSWER-A programming language where one statement in the
language translates to exactly one statement of machine code
Assignment statement
STAGE 1 VOCAB - ANSWER-A Java statement that stores a value into a variable.
<type> <name> = <value>
Breakpoint