• 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)

CS230 Midterm 1 || Graded A+ Already.

Document preview thumbnail
Preview 2 out of 7 pages

CS230 Midterm 1 || Graded A+ Already.

Content preview

CS230 Midterm 1 || Graded A+ Already.
As a four-armed animal, Duncan the Dog prefers to represent numbers using a base 4 number
system. If Duncan gives you the base 4 number 1110, what is the equivalent decimal value?
correct answers 64 + 16 + 4 = 84

Associate the variable types with their storage sizes in a x86-32bit machine.
char
short
int
double correct answers char: 1
short: 2
int: 4
double: 8

You are doing a right shift using signed 8-bit binary numbers.
Convert -25 to a signed 8-bit binary number in two's complement.
Then do >> 4.
What is the decimal value of this number? correct answers Convert -25 to signed 8-biy binary
number in twos complement: 25 = 11001
-25 (in 2s complement) = 11100111
>>4 = 11111110
Convert to decimal:
11111101 -> 00000010
= 2 *-1 = -2

The answer: -2

We wish to examine two values 𝑎 and 𝑏 in memory and generate a new one which satisfies the
following: if both 𝑎 and 𝑏 have the same value in a particular bit position, then that position in
our new value should be a 1, otherwise it is 0. For instance, if 𝑎 = 0101 and 𝑏 = 0111 then the
new value will be 1101. Which of the following generates our desired value? correct answers
~(a^b)

What is the minimal number of bits required to represent (unsigned) hexadecimal 48F? correct
answers 11

What's the result (in binary) of adding the two 8-bit binary numbers 00111110 and 01000010?
Please indicate if there's an overflow or underflow happen after the computation. signed?
unsigned? correct answers signed: 10000000 (overflow: sum of two positive numbers causes
negative number)
unsigned: 10000000

In the context of IEEE Standard for Single Precision Floating Point representation, the value
given is '0 10000000 111000000000000000000', what is its decimal equivalent, i.e., 0.001?
correct answers 3.75

, Given a 8 digit binary number 11010001 in Two's Complement, please convert it to a decimal
number. correct answers -47

You are doing a right shift using signed 8-bit binary numbers.
Convert -26 to a signed 8-bit binary number in two's complement.
Then do >> 4.
What is the decimal value of this number? correct answers -2

What is the output of the following code?

unsigned int z = 23;
int count = 0;
for(z = 9; z >= 0; z--){
count++;
}
printf("%d", count); correct answers No output. It is an infinite loop.
unsigned int

The data type of a variable is important in programming languages like C. In addition to telling
the compiler how much space to allocate for a variable, they also give information on how to
interpret a sequence of bits. Consider you use an unsigned short (size: 2 bytes) pointer to store
the following bits:
00001000 00001110
Then you dereference the pointer to obtain a value, and print the referenced in base 10. what
value would be printed?
hint: the decimal number of 00001000 is 8 and the decimal number of 00001110 is 14. correct
answers 100000001110 = 2062

As a four-armed animal, Duncan the Dog prefers to represent numbers using a base 4 number
system. If Duncan gives you the base 4 number 2232, what is the equivalent decimal value?
correct answers 174

Please evaluate the following boolean operations of 10000101 & 00000110. The answer should
be a binary number. correct answers 00000100

Assume we have a machine that uses 1 byte for a short int and 2 bytes for an int. What's the
binary value of z after running the following code.
short int x = -109; // binary sequence is 10010011
int y = x;
unsigned int z = y; correct answers 1111111110010011

Let 𝑘>𝑚>�>�> 1 and 𝑎≥�≥ 1 be an unbounded integer. What does the following equate to?
correct answers

Document information

Uploaded on
June 16, 2026
Number of pages
7
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$11.39

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
811
Followers
438
Items
40316
Last sold
1 week 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