You are REQUIRED to have a partner for lab checkoffs. This will reduce the number of check-offs we have to perform (allowing us to answer more of your questions) as well as give you someone to discuss class material with. BOTH partners will need to be present at check-off to receive credit and both partners will be asked to participate during the check-off. Try your best to find someone in your lab section with similar work habits as yourself.
You'll notice that at the end of (almost) every exercise, there is a section labelled "Check-off." The items in this section are what you must successfully demonstrate to your TA in order to receive credit for completing the lab. Once you and your partner finish ALL of the exercises, you should put your names AND ShanghaiTech email address on the checkoff list on the board, and a TA will come and check you off.
You will make an appointment with your Lab TA and your lab partner to be checked off online. This appointment should be during (or close to) the actual lab time. You will then make a zoom call with all 3 persons. The students share their screen and then discuss and check off all items in the lab.
Labs are graded out of x points, which will evaluate to 100%. A lab is considered on-time if it is turned in within a week of the lab session in which it is initially assigned to you. For example, the lab assigned to you in this weeks lab is this document, lab 1. Thus, the latest you may get lab 1 checked off is the beginning of your lab next week.
Let's take 4-bit numbers. If we stack five 4-bit numbers on top of each other in binary, we can make patterns and pictures! To help visualize this, you can think of 0's and 1's as white and black instead. For example, what does the following bit pattern look like?
0 | 1 | 1 | 0 | □ | ■ | ■ | □ | |
1 | 0 | 0 | 1 | ■ | □ | □ | ■ | |
1 | 1 | 1 | 1 | --> | ■ | ■ | ■ | ■ |
1 | 0 | 0 | 1 | ■ | □ | □ | ■ | |
1 | 0 | 0 | 1 | ■ | □ | □ | ■ |
I hand you a thousand $1 bills and ten envelopes. Your job is to find a way to put various numbers of dollar bills in those ten envelopes so that no matter what amount of money I ask you for (between $1-1000), you can simply hand me some combination of envelopes and always be assured of giving me the correct amount of cash.
Write a C program that displays the sizes (in byte) of different data types. You are only allowed to have one printf
in the program - it has to be used inside a precompiler macro. This macro can only have one argument. Each type should be output in a new line similar to this (with correct values of course):
Size of short: 3
The sizes of the following types should be printed:
Size of int: 5
gcc -Wpedantic -Wall -Wextra -Werror -std=c89
-m32
to compile it for 32bit and -m64
to compile it for 64bit.