cs50 quiz preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • submit the quiz via...
TRANSCRIPT
![Page 1: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/1.jpg)
CS50 Quiz Preparation
![Page 2: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/2.jpg)
Quiz Logistics
![Page 3: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/3.jpg)
Quiz Logistics
• Released Sat 11/10 noon, due Thu 11/15 noon
• Open-book for all non-human resources
• Submit the quiz via submit50
![Page 4: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/4.jpg)
How to Prepare
• Review lecture notes, source code, slides, video
• Attend or watch review session
• Take past years' tests and quizzes
• Review problem set specifications, sample solutions, distribution code
![Page 5: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/5.jpg)
Themes
![Page 6: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/6.jpg)
Themes
• Representing Data
• Abstraction
• Algorithms
• Trade-Offs
• Security
![Page 7: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/7.jpg)
Week 0Computational Thinking, Scratch
![Page 8: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/8.jpg)
Binary
0Bit
![Page 9: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/9.jpg)
Binary
1Bit
![Page 10: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/10.jpg)
Binary
00011100Byte
![Page 11: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/11.jpg)
Binary
00011100Byte
2021222324252627
![Page 12: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/12.jpg)
A B C D E ... Z65 66 67 68 69 ... 90
a b c d e ... z97 98 99 100 101 ... 122
ASCII
![Page 13: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/13.jpg)
RGB
30 216 185
![Page 14: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/14.jpg)
AlgorithmsInput Output
![Page 15: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/15.jpg)
Functions
![Page 16: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/16.jpg)
Variables
![Page 17: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/17.jpg)
Conditions
![Page 18: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/18.jpg)
Boolean Expressions
![Page 19: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/19.jpg)
Loops
![Page 20: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/20.jpg)
Week 1C
![Page 21: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/21.jpg)
#include <stdio.h>
int main(void)
{
printf("hello, world!\n");
}
![Page 22: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/22.jpg)
Types•int
•char
•long
•float
•double
•string
•bool
•...
![Page 23: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/23.jpg)
Variables
string answer = get_string("What's your name?\n");
printf("%s\n", answer);
![Page 24: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/24.jpg)
Conditionsif (x < y)
{
printf("x is less than y\n");
}
else if (x > y)
{
printf("x is greater than y\n");
}
else
{
printf("x is equal to y\n");
}
![Page 25: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/25.jpg)
Loopsfor (int i = 0; i < 10; i++)
{
...
}
while (x < 10)
{
...
}
do
{
...
}
while (x < 10);
![Page 26: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/26.jpg)
Functions
void cough(int n)
{
for (int i = 0; i < n; i++)
{
printf("cough\n");
}
}
![Page 27: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/27.jpg)
Floating-Point Imprecision
x: 2
y: 10
x / y = 0.2000000029802322387695312500
![Page 28: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/28.jpg)
Integer Overflow#include <stdio.h>
#include <unistd.h>
int main(void)
{
// Iteratively double i
for (int i = 1; ; i *= 2)
{
printf("%i\n", i);
sleep(1);
}
}
![Page 29: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/29.jpg)
Week 2Arrays
![Page 30: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/30.jpg)
Compiling
clang -o hello hello.c -lcs50
![Page 31: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/31.jpg)
Source CodePreprocessing
Compiling
Assembling
Linking
Machine Code
![Page 32: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/32.jpg)
Debugging
•help50
•printf
•debug50
![Page 33: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/33.jpg)
int value = 28;value
28
int values[5];
values
Arrays
![Page 34: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/34.jpg)
int values[5];
values
values[0] = 10;
values[1] = 20;
values[3] = 40;
10 20 40
Arrays
![Page 35: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/35.jpg)
string name = "Zamyla";
name
Z a m y l a \0
Strings
![Page 36: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/36.jpg)
string name = "Zamyla";
name
90 97 109 121 108 97 0
Strings
![Page 37: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/37.jpg)
$ make mario
$ ./cash
$ clang -o hello hello.c
Command-Line Arguments
![Page 38: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/38.jpg)
int main(int argc, string argv[])
{
...
}
Command-Line Arguments
![Page 39: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/39.jpg)
Sorting
• Bubble Sort
• Selection Sort
• Merge Sort
![Page 40: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/40.jpg)
Time Complexity
Algorithm Time Complexity
Bubble Sort O(n2)
Selection Sort O(n2)
Merge Sort O(n log n)
![Page 41: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/41.jpg)
Week 3Memory
![Page 42: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/42.jpg)
Pointers
![Page 43: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/43.jpg)
Types
int Integer
char Character
![Page 44: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/44.jpg)
Types
int * Address of an Integer
char * Address of a Character
![Page 45: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/45.jpg)
Pointers
• type * declares a pointer that stores the address of a type • *x takes pointer x and gets the value at the address
• "dereference" operator • &x takes variable x and gets its address
![Page 46: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/46.jpg)
![Page 47: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/47.jpg)
int a = 28;
![Page 48: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/48.jpg)
int a = 28;
![Page 49: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/49.jpg)
int a = 28;
a
![Page 50: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/50.jpg)
int a = 28;
a 28
![Page 51: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/51.jpg)
int a = 28;0x10
a 28
![Page 52: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/52.jpg)
int a = 28;0x10
a 28int b = 50;
![Page 53: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/53.jpg)
int a = 28;0x10
a 28int b = 50;
b
0x14
![Page 54: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/54.jpg)
int a = 28;0x10
a 28int b = 50;
b
0x14
50
![Page 55: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/55.jpg)
int a = 28;0x10
a 28int b = 50;
b
0x14
50
int *c = &a;
![Page 56: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/56.jpg)
int a = 28;0x10
a 28int b = 50;
b
0x14
50
int *c = &a;
c
0x18
![Page 57: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/57.jpg)
int a = 28;0x10
a 28int b = 50;
b
0x14
50
int *c = &a;
c
0x18
0x10
![Page 58: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/58.jpg)
int a = 28;0x10
a 28int b = 50;
b
0x14
50
int *c = &a;
c
0x18
0x10
*c = 14;
![Page 59: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/59.jpg)
int a = 28;0x10
a 14int b = 50;
b
0x14
50
int *c = &a;
c
0x18
0x10
*c = 14;
![Page 60: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/60.jpg)
int a = 28;
a 14int b = 50;
b 50
int *c = &a;
c 0x10
*c = 14;
c = &b;
0x10
0x14
0x18
![Page 61: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/61.jpg)
int a = 28;
a 14int b = 50;
b 50
int *c = &a;
c 0x14
*c = 14;
c = &b;
0x10
0x14
0x18
![Page 62: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/62.jpg)
int a = 28;
a 14int b = 50;
b 50
int *c = &a;
c 0x14
*c = 14;
c = &b;
*c = 20;
0x10
0x14
0x18
![Page 63: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/63.jpg)
int a = 28;
a 14int b = 50;
b 20
int *c = &a;
c 0x14
*c = 14;
c = &b;
*c = 20;
0x10
0x14
0x18
![Page 64: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/64.jpg)
Memory Layout
![Page 65: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/65.jpg)
![Page 66: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/66.jpg)
Stack
![Page 67: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/67.jpg)
Stack functions' variables and arguments
![Page 68: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/68.jpg)
Stack
Heap
functions' variables and arguments
![Page 69: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/69.jpg)
Stack
Heap dynamically allocated memory
functions' variables and arguments
![Page 70: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/70.jpg)
Stack
Heap dynamically allocated memory
functions' variables and arguments
![Page 71: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/71.jpg)
File I/O
![Page 72: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/72.jpg)
File I/O
• Opening a file • Reading from a file • Writing to a file • Changing position in a file • Closing a file
![Page 73: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/73.jpg)
FILE *foo = fopen("filename.txt", "w");
Pointer to file
Function to open file
Name of file to open File mode(r, w, a)
![Page 74: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/74.jpg)
fread(ptr, size, blocks, fp)
Where to store result of reading file
Size of a block to read
Number of blocks to read
Pointer to file to read from
![Page 75: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/75.jpg)
fwrite(ptr, size, blocks, fp)
Pointer to data to write
Size of a block to write
Number of blocks to write
Pointer to file to write to
![Page 76: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/76.jpg)
fseek(fp, offset, whence)
Pointer to file
How much to move file position by SEEK_SET,
SEEK_CUR,
SEEK_END
![Page 77: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/77.jpg)
fclose(fp)
Pointer to file
![Page 78: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/78.jpg)
Week 4Data Structures
![Page 79: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/79.jpg)
Arrays
10 20 30 40 50 60 70 80
90
![Page 80: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/80.jpg)
Linked List
typedef struct node
{
int n;
struct node *next;
}
node;
next
n
![Page 81: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/81.jpg)
Linked List
![Page 82: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/82.jpg)
Linked List
node *list = malloc(sizeof(node));
![Page 83: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/83.jpg)
Linked List
node *list = malloc(sizeof(node));next
n
0x280
![Page 84: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/84.jpg)
Linked List
node *list = malloc(sizeof(node));next
n
list
0x280
![Page 85: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/85.jpg)
Linked List
node *list = malloc(sizeof(node));next
n
0x280
list
0x280
![Page 86: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/86.jpg)
Linked List
node *list = malloc(sizeof(node));next
n
0x280
list
0x280
list->n = 10;
![Page 87: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/87.jpg)
Linked List
node *list = malloc(sizeof(node));
10next
n
0x280
list
0x280
list->n = 10;
![Page 88: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/88.jpg)
Linked List
node *list = malloc(sizeof(node));
10next
n
0x280
list
0x280
list->n = 10;
list->next = NULL;
![Page 89: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/89.jpg)
Linked List
node *list = malloc(sizeof(node));
10
NULLnext
n
0x280
list
0x280
list->n = 10;
list->next = NULL;
![Page 90: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/90.jpg)
Linked List
10next
n
20next
n
30next
n
0x500 0x600 0x700
![Page 91: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/91.jpg)
Linked List
10
0x600next
n
20next
n
30next
n
0x500 0x600 0x700
![Page 92: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/92.jpg)
Linked List
10
0x600next
n
20
0x700next
n
30next
n
0x500 0x600 0x700
![Page 93: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/93.jpg)
Linked List
10
0x600next
n
20
0x700next
n
30
NULLnext
n
0x500 0x600 0x700
![Page 94: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/94.jpg)
Linked List
10
0x600next
n
20
0x700next
n
30
NULLnext
n
0x500 0x600 0x700
![Page 95: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/95.jpg)
Linked List
10next
n
20next
n
30next
n
0x500 0x600 0x700
![Page 96: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/96.jpg)
Linked List
10next
n
20next
n
30next
n
0x500 0x600 0x700
head
![Page 97: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/97.jpg)
Hash Tables
![Page 98: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/98.jpg)
10 13 28 5 11 16 ...
head
![Page 99: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/99.jpg)
10 28 16 ...
even_head
13 5 11 ...
odd_head
![Page 100: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/100.jpg)
10 28 16
13 5 11
![Page 101: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/101.jpg)
act
head
bin ace cat cave
![Page 102: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/102.jpg)
a
b
c
d
z
...
act ace
bin
cat cave
![Page 103: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/103.jpg)
Hash Function
unsigned int hash(const char *word)
{
return tolower(word[0]) - 'a';
}
![Page 104: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/104.jpg)
Trees1
2 3
4 5 6 7
![Page 105: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/105.jpg)
Binary Search Tree28
14 38
5 19 30 52
![Page 106: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/106.jpg)
TriesA B C D ... X Y Z
A B C D ... X Y Z
A B C D ... X Y Z
![Page 107: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/107.jpg)
Tries
typedef struct node
{
bool is_word;
struct node *children[27];
}
node;
![Page 108: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/108.jpg)
Week 5HTTP, HTML, CSS
![Page 109: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/109.jpg)
TCP/IP
![Page 110: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/110.jpg)
TCP/IP
![Page 111: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/111.jpg)
TCP/IP
28.28.28.28 42.42.42.42
![Page 112: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/112.jpg)
TCP/IP
28.28.28.28
From: 28.28.28.28
To: 42.42.42.42
Port: 80
Packet: 2 of 4
42.42.42.42
![Page 113: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/113.jpg)
DNS
hostname ip
google.com 172.217.7.206
harvard.edu 23.22.75.102
yale.edu 104.16.243.4
apple.com 17.172.224.47
github.com 192.30.253.112
![Page 114: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/114.jpg)
HTTP
![Page 116: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/116.jpg)
HTTP Status Codes
• 200 • 301 • 403 • 404 • 500 • ...
![Page 117: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/117.jpg)
HTML
![Page 118: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/118.jpg)
HTML<!DOCTYPE html>
<html>
<head>
<title>hello!</title>
</head>
<body>
hello, world!
</body></html>
![Page 119: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/119.jpg)
CSS
![Page 120: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/120.jpg)
CSS
element
{
property: value;
}
![Page 121: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/121.jpg)
CSS
#id
{
property: value;
}
![Page 122: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/122.jpg)
CSS
.class
{
property: value;
}
![Page 123: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/123.jpg)
JavaScript
![Page 124: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/124.jpg)
DOM<!DOCTYPE html>
<html>
<head>
<title>hello!</title>
</head>
<body>
hello, world!
</body></html>
![Page 125: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/125.jpg)
DOM<!DOCTYPE html>
<html>
<head>
<title>hello!</title>
</head>
<body>
hello, world!
</body></html>
html
head body
title hello, world!
hello!
![Page 126: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/126.jpg)
Week 6Python
![Page 127: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/127.jpg)
Variables
x = 28
y = "Hello"
z = True
![Page 128: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/128.jpg)
print("Hello!")
print("Hello!", end=" ")
print(x)
print("Hello,", name)
![Page 129: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/129.jpg)
Conditions
if x > 0:
print("Positive")
else:
print("Not positive")
![Page 130: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/130.jpg)
Conditionsif x > 0:
print("Positive")
elif x < 0:
print("Negative")
else:
print("Zero")
![Page 131: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/131.jpg)
Lists
days = ["Sunday", "Monday", "Tuesday"]
![Page 132: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/132.jpg)
Loops
for i in range(5):
print(i)
![Page 133: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/133.jpg)
Loops
for item in items:
print(item)
![Page 134: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/134.jpg)
Functions
def add(a, b):
return a + b
![Page 135: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/135.jpg)
Data Structures
list
tuple
set
dict
![Page 136: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/136.jpg)
Week 7Web Programming
![Page 137: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/137.jpg)
MVC
• Model • View • Controller
![Page 138: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/138.jpg)
Flask
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
![Page 139: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/139.jpg)
Week 8SQL
![Page 140: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/140.jpg)
DatabaseTable
Table Table
Table
![Page 141: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/141.jpg)
SQL Data Types
•INTEGER: smallint, integer, bigint
•NUMERIC: boolean, date, datetime, numeric(scale, precision), time, timestamp
•REAL: real, double precision
•TEXT: char(n), varchar(n), text
![Page 142: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/142.jpg)
SQL
CREATE TABLE registrants (
id INTEGER PRIMARY KEY,
name VARCHAR(255),
dorm VARCHAR(255)
)
![Page 143: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/143.jpg)
SQL
INSERT INTO registrants (id, name, dorm)
VALUES (1, 'David', 'Matthews')
![Page 144: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/144.jpg)
SQL
SELECT * FROM registrants
![Page 145: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/145.jpg)
SQL
SELECT name, dorm FROM registrants
![Page 146: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/146.jpg)
SQL
SELECT name, dorm FROM registrants
WHERE dorm = 'Matthews'
![Page 147: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/147.jpg)
SQL
UPDATE registrantsSET name = 'David Malan'
WHERE id = 1
![Page 148: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/148.jpg)
SQL
DELETE FROM registrants WHERE id = 1
![Page 149: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/149.jpg)
Multiple Tables
• Foreign Keys • Joining Tables
![Page 150: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/150.jpg)
SQL
• Race Conditions • SQL Injection Attacks
![Page 151: CS50 Quiz Preparationcdn.cs50.net/2018/fall/quiz/preparation.pdf · • Submit the quiz via submit50. How to Prepare ... 90 97 109 121 108 97 0 Strings $ make mario $ ./cash $ clang](https://reader030.vdocument.in/reader030/viewer/2022040210/5e616661123ae92cb46171c7/html5/thumbnails/151.jpg)
CS50 Quiz Preparation