CS 2261 Exam 1 - Lecture Quizzes and Kahoot Reveiw
L3. In the color where of light, Blue + Green = ?
Cyan
15. True/False: Automatically allocated variables have an initial value of 0 for integer types, 0.0 for floats, and NULL for all pointers.
False. Automatically allocated values are determined at runtime.
10. True/False: The criteria for determining collision between two objects is: If their x values overlap, there is a collision.
False. Check for Y overlap too.
9. True/False: The last pixel (bottom right corner) on the GBA screen is at index (240, 160).
False. It's (239, 159)
13. True/False: Header and source files must have the same name if they go together (e.g. gba.c and gba.h).
False. Matching headers are not required.
22. True/False: For enums, value cannot overlap anywhere in the same scope.
False. Values can overlap. Names cannot.
L5. What graphical effect happens when an object on the screen is being erased and redrawn out of sync with the screen's refresh rate?
Flickering
14. What should go in source files (.c)?
Function Declarations, Global Variables, Assignments to go in source files
L5. What belongs to a .h file by convention in C?
Function Prototypes, typedefs, variable declarations, preprocessor macros
16. The static keyword reduces scope when it's added to a:
Global Variables, Global Functions
L4. What is shorter? VBlank or HBlank?
HBlank
2. Which type of MOSFET is normally "open" (switched off)?
N-Type
L4. What is the algorithmic efficiency (Big O) on collision checks between objects?
O(n^2)
L2: Which of the following are bitwise operators of C? A. ~ B. :: C. & D. || E. <<
~ & <<
21. How do we solve the array length problem inside of functions?
Pass the Length as an argument
L3. What type does C use for storing memory addresses?
Pointers
4. RAM stands for:
Random Access Memory
8. What does little endian mean when reading a number?
Reads the Smallest Values First
L4. Which C compilation step turns .c / .h files into .i files?
The Preprocessor
19. True/False: The space allocated in memory for arrays is ALWAYS consecutive
True
7. True/False: Compiled languages do more work before runtime compared to interpreted languages
True
L6. True/False A C variable's storage duration affects its initial value
True
L6. What is the initial value of the variable 'bar' below? int foo; int main() { int bar; // Program does something with foo }
Unknown / Determined at Runtime
L1: In electronics NOT gate would turn +5 Volts into?
Zero Volts
L5. What keyword tells the compiler a variable comes from somewhere other than the current scope/file?
extern
18. What type would the following code swap? void swap(int** a, int**b) { int* temp = *a; *a = *a; *b = temp; }
int* (Look at the type of the temp variable)
L3. The C syntax to declare an integer pointer variable named myIntegerPointer is:
int* myInegerPointer;
3. What data type(s) are of size 4 bytes (32 bits) on the GBA?
long, int
11. What is a macro we can use to detect non-continuous movement (e.g. player selecting an item)?
#define Button_Pressed(key) ((!(~oldButtons&(key))) && (~buttons&(key)))
17. Which of the following is/are benefit(s) of macros over functions?
1. Optimized for Speed 2. Work with different types due to operator overloading
L7. True/False enumerations in C are strongly typed, with enforcement by the compiler
False
L7. True/False: C has a string data type.
False
L7. True/False: C is an Object-Oriented Language.
False
L4. What keyword do we use in C to tell it not to over-optimize code dealing with hardware?
volatile
6. If we have the code: [int* boo = 0x05000000;], how would we change the value in the memory address 0x05000000?
*boo = value
L7. What C operator combines the struct field access with a deference?
->
L6. What is the initial value of the variable 'foo' below? int foo; int main() { // Program does something with foo }
0
L5. True/False: Our Compilation Process notices when a header file has changes (and recompiles all .c files using it)
False
1. What is the result of the bitwise operation 1101 & 1010?
1000
L1: In binary: 1 + 1 + 1 = ??
11
L3. 11001010 | 10001111 = ??
11001111
5. How many bits does Mode 3 use for color?
16 bits (2 bytes)
L6. What is sizeOf(arr) on the GBA? int arr[7];
28
L2: What is the unsigned decimal (base 10) equivalent of 0x1f?
31
L2: What is the word size of the GBA platform?
32
L4. How many extra scanlines does the GBA pretend to draw in the VBlank period?
68
A transistor is typically used as a motionless equivalent to:
A Switch
Which of the following are valid interpretations of the bits 1111 0101? A. 0365 B. 0xf5 C. 245 D. -13 E. -11
A, B, C, E
L1: In Computer Engineering, ALU stands for:
Arithmetic Logic Unit
12. When is the best time to call waitForVBlank()?
Before draw()
L1: What Organization Invented the Transistor?
Bell Labs
L3. Storing multiple values in the same integer is an example of a
Bit Vector
L2: What was the name o the first computer to use the Von Neumann Architecture?
EDVAC
L6. True/False: C arrays *always* remember their own size.
False
20. What would be the value of sizeof(ptr) and sizeof(arr) after this code runs? int arr[6] = {0, 1, 2, 3, 4, 5}; int* ptr; ptr = arr;
sizeof(arr) = 24 sizeof(ptr) = 4
L5. What keyword is both a storage duration and a scope modifier in C?
static
