correct answers 2025/2025
Are arrays pointers? - ANSWERS NOOOOOOOOO
They are closely related, but NOT the same!!! They are NOT interchangeable!!
Are bitwise zero and hexadecimal zero the same thing? - ANSWERS Yes!
Are our x and y components stored directly?
What are they stored as? - ANSWERS No, they are stored as x' and y':
x' = 0, x = 1.0
y' = 127, y = 0
Are pointers and arrays always interchangeable? - ANSWERS No!
At what time during execution are components in the Text and Data sections
created? - ANSWERS Compile time, created by the compiler
,Buffering in Standard I/O makes it _____________ than Unix I/O when making
many short reads or writes. - ANSWERS more efficient
Calculate the decimal value of the binary number 101.011. - ANSWERS 5.375
Can order of operations have an impact on program performance? If so, why? -
ANSWERS Yes, because they can cause differences in the way memory is
accessed.
Can you assign a String to an Array of chars?
Ex: char str[32]; str = "Hello"; - ANSWERS No, you would have to change each
value with each char of "Hello".
Can you assume the value of padding? - ANSWERS No! It's garbage.
Can you use sizeof to determine the size of an array? - ANSWERS NO! It's
unreliable, and will return 8 bytes, the size of a pointer.
Define Dereference in terms of programming. - ANSWERS To go to the
referenced location and find the value stored there
Define Serialization. - ANSWERS The storage of data into a byte sequence
Define Stride. - ANSWERS The difference between two points to adjacent values
of a particular type
,Define the Significand and Exponent in terms of Floating Point Numbers. -
ANSWERS Significand: "x" the meaningful digits of a number
Exponent: "y" the "distance" of those digits from zero in powers of the given base
Describe the following code:
char *str = "Hello"; - ANSWERS str containts an address, and the data stored in str
is of type char
Describe the size of the "Middle Sections" of memory.
(Heap and Stack) - ANSWERS Begin with zero size, then grow as needed during
execution
Do all numbers with a finite number of digits in decimal have a terminating
representation in binary? - ANSWERS No, this is false.
Do errors and EOF return the same value in Unix I/O? Standard I/O? - ANSWERS -
Unix: no
- Standard: yes
Given a pointer allocated by malloc, how can the programmer find out how much
memory was requested at that allocated time? - ANSWERS There is no way to tell
unless the size is stored somewhere else when malloc is used.
, How are Pthreads declared and used? - ANSWERS - declared as values
- used as pointers
How are variables in BSS treated during execution? - ANSWERS Created at
compule time, then set to zero at run time
How can we allocate for an array, or multiple adjacent entries, using malloc?
(use an array of ints as an example) - ANSWERS int *arr = malloc(10 * sizeof(int))
^^ allocate for n entries * sizeof(type)
How can you calculate:
bits -> bytes
bytes -> bits - ANSWERS bits-> bytes: divide by 8
bytes -> bits: multiply by 8
How can you tell if a Hexadecimal is negative? - ANSWERS If the hexadecimal
begins with a number greater than or equal to 8, it will be negative.
Whatever comes after the x can be converted to binary. IF 1, then negative; if 0,
then positive.