• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 7 pages
Exam (elaborations)

CS 220 Final Study Guide || A+ Verified Solutions.

Document preview thumbnail
Preview 2 out of 7 pages

#define FOO(a, b) ((a x a) + (b x b)) ... printf("%d", FOO(1, 2+3); What is printed out? a. 22 b. 24 c. 26 d. 12 correct answers d What is the output of the following code snippet? ... int arr[] = {1, 2, 3, 4}; int i, sum; for (i = 0, sum = 0; i 4, i++){ sum += arr; arr++; } ... a. compilation error b. segmentation error c. 10 d. 6 correct answers b If the function foo has the following signature: void foo(int a, int b, int c, int d); how is b passed to foo? a. In rdi b. In rsi c. In rbx d. On the stack correct answers b in Intel x86, stack pointer: a. stores the flag registers b. points the top of the program stack c. stores the stack variables d. servers as an accumulator correct answers b In 32 bit IEEE 754 floating point standard, how many bits are reserved for exponent and precision? a. 9 and 22 b. 8 and 23 c. 8 and 24 d. 7 and 24 correct answers b

Content preview

CS 220 Final Study Guide || A+ Verified Solutions.
#define FOO(a, b) ((a x a) + (b x b))
...
printf("%d", FOO(1, 2+3);
What is printed out?
a. 22
b. 24
c. 26
d. 12 correct answers d

What is the output of the following code snippet?
...
int arr[] = {1, 2, 3, 4};
int i, sum;
for (i = 0, sum = 0; i < 4, i++){
sum += arr;
arr++;
}
...
a. compilation error
b. segmentation error
c. 10
d. 6 correct answers b

If the function foo has the following signature:
void foo(int a, int b, int c, int d);
how is b passed to foo?
a. In rdi
b. In rsi
c. In rbx
d. On the stack correct answers b

in Intel x86, stack pointer:
a. stores the flag registers
b. points the top of the program stack
c. stores the stack variables
d. servers as an accumulator correct answers b

In 32 bit IEEE 754 floating point standard, how many bits are reserved for exponent and
precision?
a. 9 and 22
b. 8 and 23
c. 8 and 24
d. 7 and 24 correct answers b

, In 32 bit IEEE 754 floating point standard, which of the following bit patterns represents
+infinity?
a. 01111111100000000000000000000000
b. 01111111111100000000000000000000
c. 01111111111111111111111111111111
d. None of the other choices correct answers a

In 32 bit IEEE 754 floating point standard, which of the following bit patterns does not represent
NaN?
a. 11111111100000000000000000000000
b. 01111111100000000000000000000000
c. 01111111111111111111111111111111
d. Both a and b correct answers a because it is -infinity

Pick the most appropriate statement regarding structures in C.
a. Size of a structure in memory is exactly equal to the sum of its members
b. If a structure has 2 members, address of the 2nd member is always greater than the address of
the 1st member
c. The compiler may split a structure into multiple parts and allocate them on different pages to
optimize memory utility.
d. All structure must be typedefined using typedef correct answers b

In Intel x86:
a. Function arguments are pushed on the stack left to right
b. Function arguments are pushed on the stack right to left.
c. the order in which arguments are populated does not matter
d. Except variable argument functions like printf, arguments are pushed from left to right for all
other functions correct answers b

In the following code (assume syntactic correctness and no protections in place), buffer overflow
WILL NOT occur if:
int main(){
char s[A], d[B];
...
fgets(s, 128, STDIN);
strcpy(d, s);
...
}
a. if A <= B and B == 128
b. if B <= A and A == 128
c. if A > 128 and B > 128
d. if A >= 128 and B > A correct answers d because fgets reads in 128 bits in s, so A >= 128 and
d must be larger than s, so B > A

The following code:
...

Document information

Uploaded on
March 12, 2025
Number of pages
7
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$11.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
SirAnton
3.7
(118)
Sold
810
Followers
438
Items
40067
Last sold
6 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions