Apsc 160 Final 2025-2026 QUESTIONS AND
VERIFIED ANSWERS ALREADY GRADED A+
What does C language compiler do? - ANSWERStranslate from C into machine language
How do you declare a character variable containing the string? - ANSWERSEx: if variable is s and string is
foo=
char s[] = "foo";
What expression is always true? - ANSWERS|| = or, && = and, therefore, (p || !p) is always true
Global Variable - ANSWERSis accessible to any function that wants to use it
Local Variable - ANSWERSa specific type of variable that are only available within the context of a
particular expression and can only be accessed within the function that defines them.
Character variables in C are passed to functions... - ANSWERSby value
How to write Radius^2? - ANSWERSpow(radius, 2)
Steps to using a file in a program? - ANSWERS1. Open file with file pointer:
-File*inputFile;
-inputFile=fopen("file_for_opening.txt", "r" or "w");
2. Verify it was opened and print error if not:
-if(inputFile != NULL){} else {/*something went wrong*/ printf("Error opening input file\n");}
3. Using File (read or write):
,-fscanf((filepointer, extra parameter), formatstring, $var1, ..., &varN);
-fprintf(filepointer, formatstring, var1, ... , varN);
4. Close file:
-fclose(inputFile);
How to read from a file? - ANSWERSUse function: fscanf(filePointer, formatSpecifier, &var1, ..., &varN)
What happens when you write to a file? - ANSWERSIf it already contains data, that data will be over
written
Function for write data - ANSWERSfprintf(filePointer, formatString, &var1, ... , &varN)
How do you declare an array of unknown values? - ANSWERStype array [number]
How to declare an array of known values? - ANSWERStype array [] = {number1, number2,...}
Printing an array - ANSWERSprintf("%format",array[])
Pass-by-value mechanism - ANSWERSThe value of the actual parameter is copied and passed to the
formal parameter. It is used for primitive data types (int, char, double)
Pass-by-address mechanism - ANSWERSThe address of the actual parameter is passed to the formal
parameter. This permanently alters the actual parameter. Used for arrays with functions.
Event Controlled Loop - ANSWERSexecutes until some event occurs, you don't know ahead of time how
many times loop will execute (ex: while or do-while loops)
Counter Control Loop - ANSWERSexecutes a fixed number of times, you know ahead of time how many
times loop will execute (ex: for loops)
, Flow Chart Components - ANSWERSoval: start/end
arrow: connects components
parrallelogram: input/output
rectangle: process
diamond: decision
Binary Operators - ANSWERS&& and
|| or
Unary Operators - ANSWERS!= not
Boolean Expression - ANSWERSUses true or false evaluations with relation operators
Relation operators - ANSWERS< less than
> greater than
<= less than or equal to
>= greater than or equal to
!= not equal to
== equal to
Algorithm - ANSWERSunambiguous sequence of step-by-stpe instructions for solving a problem
When testing floating point values for accuracy we must give within a range because points cannot be
exact, what expression must we use? - ANSWERSex: num value is 0.3, within 0.0001 accuracy-
(fabs(num-0.3)<0.0001)
How to set up a for loop? - ANSWERSfor(initial_statement, booleanExpression; post_in/decrement)
initial: initiales variable
boolexp: true or false
VERIFIED ANSWERS ALREADY GRADED A+
What does C language compiler do? - ANSWERStranslate from C into machine language
How do you declare a character variable containing the string? - ANSWERSEx: if variable is s and string is
foo=
char s[] = "foo";
What expression is always true? - ANSWERS|| = or, && = and, therefore, (p || !p) is always true
Global Variable - ANSWERSis accessible to any function that wants to use it
Local Variable - ANSWERSa specific type of variable that are only available within the context of a
particular expression and can only be accessed within the function that defines them.
Character variables in C are passed to functions... - ANSWERSby value
How to write Radius^2? - ANSWERSpow(radius, 2)
Steps to using a file in a program? - ANSWERS1. Open file with file pointer:
-File*inputFile;
-inputFile=fopen("file_for_opening.txt", "r" or "w");
2. Verify it was opened and print error if not:
-if(inputFile != NULL){} else {/*something went wrong*/ printf("Error opening input file\n");}
3. Using File (read or write):
,-fscanf((filepointer, extra parameter), formatstring, $var1, ..., &varN);
-fprintf(filepointer, formatstring, var1, ... , varN);
4. Close file:
-fclose(inputFile);
How to read from a file? - ANSWERSUse function: fscanf(filePointer, formatSpecifier, &var1, ..., &varN)
What happens when you write to a file? - ANSWERSIf it already contains data, that data will be over
written
Function for write data - ANSWERSfprintf(filePointer, formatString, &var1, ... , &varN)
How do you declare an array of unknown values? - ANSWERStype array [number]
How to declare an array of known values? - ANSWERStype array [] = {number1, number2,...}
Printing an array - ANSWERSprintf("%format",array[])
Pass-by-value mechanism - ANSWERSThe value of the actual parameter is copied and passed to the
formal parameter. It is used for primitive data types (int, char, double)
Pass-by-address mechanism - ANSWERSThe address of the actual parameter is passed to the formal
parameter. This permanently alters the actual parameter. Used for arrays with functions.
Event Controlled Loop - ANSWERSexecutes until some event occurs, you don't know ahead of time how
many times loop will execute (ex: while or do-while loops)
Counter Control Loop - ANSWERSexecutes a fixed number of times, you know ahead of time how many
times loop will execute (ex: for loops)
, Flow Chart Components - ANSWERSoval: start/end
arrow: connects components
parrallelogram: input/output
rectangle: process
diamond: decision
Binary Operators - ANSWERS&& and
|| or
Unary Operators - ANSWERS!= not
Boolean Expression - ANSWERSUses true or false evaluations with relation operators
Relation operators - ANSWERS< less than
> greater than
<= less than or equal to
>= greater than or equal to
!= not equal to
== equal to
Algorithm - ANSWERSunambiguous sequence of step-by-stpe instructions for solving a problem
When testing floating point values for accuracy we must give within a range because points cannot be
exact, what expression must we use? - ANSWERSex: num value is 0.3, within 0.0001 accuracy-
(fabs(num-0.3)<0.0001)
How to set up a for loop? - ANSWERSfor(initial_statement, booleanExpression; post_in/decrement)
initial: initiales variable
boolexp: true or false