1. Home
  2. Explore
  3. Computer Science
  4. CS50 Intro to Programming

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

CS50 Intro to Programming

  • 63Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: CS50 Introduction

What is the primary focus of CS50, Harvard University's introductory course?

63 questions

  1. 1

    What is the primary focus of CS50, Harvard University's introductory course?

    1. A

      It focuses on the history of computer hardware development.

    2. B

      It provides advanced training in specific programming languages.

    3. C

      It introduces the intellectual enterprises of computer science and programming.

    4. D

      It primarily teaches the management of large-scale software projects.

    Correct answer
    C

    It introduces the intellectual enterprises of computer science and programming.

    Explanation

    David Malan clearly states, 'This is CS50, Harvard University's introduction to the intellectual enterprises of computer science and the art of programming.' This indicates its primary focus.

  2. 2

    Which field did David Malan initially gravitate towards as a first-year student at Harvard?

    1. A

      He initially gravitated towards things already familiar, specifically government.

    2. B

      He initially gravitated towards the natural sciences, specifically biology.

    3. C

      He initially gravitated towards the field of economics and finance.

    4. D

      He initially gravitated towards the arts and humanities, like literature.

    Correct answer
    A

    He initially gravitated towards things already familiar, specifically government.

    Explanation

    David Malan mentions, 'I really gravitated toward things already familiar, things with which I was already comfortable, specifically, government.'

  3. 3

    What was David Malan's initial enrollment decision for CS50 due to his doubts about his ability?

    1. A

      He initially enrolled as a teaching assistant to learn from others.

    2. B

      He initially decided to take the class as a corequisite with another course.

    3. C

      He initially enrolled pass/fail because he didn't think he could cut it.

    4. D

      He initially decided to audit the class without receiving any credit.

    Correct answer
    C

    He initially enrolled pass/fail because he didn't think he could cut it.

    Explanation

    Malan states, 'I actually switched to a letter grade, deciding, wow, this is actually something for me. And this was after having enrolled only because the professor let me enroll pass/fail or [INAUDIBLE] because I didn't really think I could even cut it.'

  4. 4

    How does David Malan describe computer science's applicability to other fields?

    1. A

      He describes it as a highly specialized skill only for STEM careers.

    2. B

      He describes it as a subject exclusively for those pursuing academic research.

    3. C

      He describes it as a very general purpose way of thinking and problem-solving.

    4. D

      He describes it as primarily useful for developing mobile phone applications.

    Correct answer
    C

    He describes it as a very general purpose way of thinking and problem-solving.

    Explanation

    David Malan explains, 'computer science, what I didn't realize about it at the time, really is this very general purpose way of thinking and way of solving problems.' He also mentions its applicability to 'the arts, humanities, social sciences, natural sciences, and beyond.'

  5. 5

    What analogy is used to describe the large amount of information in CS50?

    1. A

      It is described as building a complex puzzle with many small pieces.

    2. B

      It is described as climbing a very tall mountain with steep inclines.

    3. C

      It is described as navigating a dense forest without a clear path.

    4. D

      It is described as drinking from a fire hose, implying overwhelming information.

    Correct answer
    D

    It is described as drinking from a fire hose, implying overwhelming information.

    Explanation

    The speaker references an MIT hack with a sign saying, 'GETTING AN EDUCATION FROM MIT IS LIKE DRINKING FROM A FIRE HOSE,' to convey that there will be a lot of information.

  6. 6

    What is the expected state of comfort for students learning in an introductory CS class like CS50?

    1. A

      Students are expected to get comfortable feeling uncomfortable along the way.

    2. B

      Students are expected to feel comfortable along the way with continuous support.

    3. C

      Students are expected to feel entirely comfortable with all new material.

    4. D

      Students are expected to achieve complete mastery quickly to feel comfortable.

    Correct answer
    A

    Students are expected to get comfortable feeling uncomfortable along the way.

    Explanation

    David Malan states, 'But you're not meant to feel comfortable along the way. And so let me encourage you, invite you, expect you to get comfortable feeling uncomfortable along the way.'

  7. 7

    Which programming language was the sole focus of CS50 when David Malan took the class?

    1. A

      The class solely focused on the older language called C.

    2. B

      The class solely focused on the modern Python language.

    3. C

      The class solely focused on the SQL language for databases.

    4. D

      The class solely focused on web-based JavaScript and HTML.

    Correct answer
    A

    The class solely focused on the older language called C.

    Explanation

    Malan recalls, 'Now, back in my day, the class' syllabus was a little bit different. And, really, when I and all of my classmates exited the class, we would say to friends that we learned how to program in C, which is a language that we, ourselves, will still learn in this class. But that was it for languages.'

  8. 8

    Which programming language is highlighted as very much in vogue for data science and web applications today?

    1. A

      The database language SQL is highlighted for these modern applications.

    2. B

      The markup language HTML is highlighted for data science projects.

    3. C

      The older language C is highlighted for these modern applications.

    4. D

      The language Python is highlighted for data science and web applications.

    Correct answer
    D

    The language Python is highlighted for data science and web applications.

    Explanation

    The speaker mentions, 'But nowadays, as you'll see, we'll explore not just this older language called C, but a more modern language called Python that's very much in vogue for data science, and web applications, and much more.'

  9. 9

    What is the primary purpose of SQL (S-Q-L) as a programming language?

    1. A

      It is a general-purpose language for scientific computations.

    2. B

      It is specifically designed for interacting with databases.

    3. C

      It is used for developing mobile applications on various platforms.

    4. D

      It is primarily used for creating graphical user interfaces.

    Correct answer
    B

    It is specifically designed for interacting with databases.

    Explanation

    The speaker states, 'But we'll also introduce you, along the way, to another language called S-Q-L or SQL, which is specifically for databases.'

  10. 10

    What is one of the main goals of CS50 regarding students' ability to learn new languages after the course?

    1. A

      To ensure students only use languages taught specifically in CS50.

    2. B

      To equip students to teach themselves new languages independently.

    3. C

      To certify students in all major programming languages upon completion.

    4. D

      To make students reliant on formal classes for learning every new idea.

    Correct answer
    B

    To equip students to teach themselves new languages independently.

    Explanation

    Among the goals of this class is to equip you with enough of a set of concepts, enough practical skills and experience that after CS50, again, if you never take another CS class, you can teach yourself new languages.'

  11. 11

    What is the overarching objective that computer science truly is all about, as emphasized in the lecture?

    1. A

      It is primarily about learning how to solve problems effectively.

    2. B

      It is primarily about managing large datasets efficiently.

    3. C

      It is primarily about designing aesthetically pleasing software interfaces.

    4. D

      It is primarily about memorizing programming language syntax.

    Correct answer
    A

    It is primarily about learning how to solve problems effectively.

    Explanation

    The speaker states, 'Well, we're going to learn how to solve problems. And that's really what computer science is all about.'

  12. 12

    What multimedia types will students learn to represent digitally by the end of the first day of CS50?

    1. A

      They will learn to represent numbers, letters, colors, images, videos, and audio.

    2. B

      They will learn to represent complex network protocols and server data.

    3. C

      They will learn to represent advanced 3D graphics and virtual reality.

    4. D

      They will only learn to represent simple text files and documents.

    Correct answer
    A

    They will learn to represent numbers, letters, colors, images, videos, and audio.

    Explanation

    By the end of today, alone, you will exit here with a newfound mental model for how you can represent all of today's media and multimedia that we take for granted and use most every day.' This includes numbers, letters, colors, images, videos, and audio.

  13. 13

    How is an 'algorithm' defined in contrast to 'code' in the lecture?

    1. A

      An algorithm is strictly binary digits, while code is higher-level instructions.

    2. B

      An algorithm is a graphical representation of a problem, and code is text-based.

    3. C

      An algorithm is step-by-step instructions in human language, and code is its implementation.

    4. D

      An algorithm is a translation of code into human language for understanding.

    Correct answer
    C

    An algorithm is step-by-step instructions in human language, and code is its implementation.

    Explanation

    An algorithm is just something you can express in English or any human language, but code is a translation of that to, presumably, the 0's and 1's that you've probably heard is all that computers ultimately speak.'

  14. 14

    What is the primary metric by which student progress is evaluated in CS50?

    1. A

      Students' progress is evaluated based on their performance relative to classmates.

    2. B

      Students' progress is evaluated based on their prior programming experience.

    3. C

      Students' progress is evaluated based on how quickly they complete assignments.

    4. D

      Students' progress is evaluated based on where they end up relative to themselves when they began.

    Correct answer
    D

    Students' progress is evaluated based on where they end up relative to themselves when they began.

    Explanation

    What ultimately matters in this class is not so much where you end up relative to your classmates, but where you end up relative to yourself, when you began.'

  15. 15

    What percentage of students in CS50 have no prior computer science course experience?

    1. A

      Approximately half of the students have no prior experience.

    2. B

      Approximately one-quarter of the students have no prior experience.

    3. C

      Approximately two-thirds of the students have no prior experience.

    4. D

      Approximately three-quarters of the students have no prior experience.

    Correct answer
    C

    Approximately two-thirds of the students have no prior experience.

    Explanation

    Realize and take comfort in knowing that two-thirds of you have never taken a CS course before.'

  16. 16

    What type of events are CS50 Puzzle Day and CS50 Hackathon examples of?

    1. A

      These are examples of mandatory workshops for learning specific languages.

    2. B

      These are examples of social and academic events that punctuate the experience.

    3. C

      These are examples of formal grading assessments for the course.

    4. D

      These are examples of required academic seminars for advanced topics.

    Correct answer
    B

    These are examples of social and academic events that punctuate the experience.

    Explanation

    And along the way, you'll see that your experience is punctuated by a lot of social and academic events alike. CS50 lunches... CS50 Puzzle Day... CS50 Hackathon.'

  17. 17

    What is the main goal of the CS50 Hackathon for students?

    1. A

      To bond with classmates and build a capstone final project independently.

    2. B

      To learn advanced programming techniques taught only at the event.

    3. C

      To compete for top grades by working individually on complex problems.

    4. D

      To quickly finish the final project with minimal effort from staff.

    Correct answer
    A

    To bond with classmates and build a capstone final project independently.

    Explanation

    And it will be this opportunity to really bond with your classmates, your project partners, if you work in a team, on your very own final project, which is meant to be a capstone of the course, something you build, yourselves, that we don't hand you a specification for.'

  18. 18

    What is the CS50 Fair described as at the very end of the class?

    1. A

      It is an exhibition of all final projects for friends, faculty, and staff.

    2. B

      It is a ceremony where students receive their course completion certificates.

    3. C

      It is a compulsory networking event with industry professionals only.

    4. D

      It is a final written examination on all course material.

    Correct answer
    A

    It is an exhibition of all final projects for friends, faculty, and staff.

    Explanation

    But at the very end of the class is the so-called CS50 Fair, an exhibition of all of your final projects for friends, faculty, students, and staff across campus.'

  19. 19

    How is computer science fundamentally defined in the lecture?

    1. A

      It is fundamentally defined as the study of software engineering principles.

    2. B

      It is fundamentally defined as the study of information and problem-solving.

    3. C

      It is fundamentally defined as the study of computer hardware components.

    4. D

      It is fundamentally defined as the study of networking and data transfer.

    Correct answer
    B

    It is fundamentally defined as the study of information and problem-solving.

    Explanation

    So, today, let's focus, then, on computer science, like what is it. Well, it's really the study of information. But, really, it's, more specifically, about solving problems.'

  20. 20

    What is 'computational thinking' oversimplistically described as?

    1. A

      It is oversimplistically described as programming in machine code.

    2. B

      It is oversimplistically described as thinking like a computer.

    3. C

      It is oversimplistically described as designing computer algorithms.

    4. D

      It is oversimplistically described as memorizing computer commands.

    Correct answer
    B

    It is oversimplistically described as thinking like a computer.

    Explanation

    So computational thinking, you can oversimplistically think about it as thinking like a computer.'

  21. 21

    What are the three core components of any problem to be solved, as proposed in the lecture?

    1. A

      The three core components are data, processing, and storage.

    2. B

      The three core components are hardware, software, and network connectivity.

    3. C

      The three core components are input, output, and the secret sauce in the middle.

    4. D

      The three core components are user interface, database, and server logic.

    Correct answer
    C

    The three core components are input, output, and the secret sauce in the middle.

    Explanation

    Problems to be solved look like this. You've got some input, the problem to be solved. You've got a goal being the output, like the solution there, too. And then somewhere in the middle is the secret sauce.'

  22. 22

    What is 'unary notation' exemplified by in the lecture?

    1. A

      Unary notation is exemplified by counting on an abacus with beads.

    2. B

      Unary notation is exemplified by using Roman numerals for representing values.

    3. C

      Unary notation is exemplified by counting on fingers, where each finger is one unit.

    4. D

      Unary notation is exemplified by a base-10 number system for counting.

    Correct answer
    C

    Unary notation is exemplified by counting on fingers, where each finger is one unit.

    Explanation

    Even simpler than binary is unary. So if you've ever, at this age or any prior age, counted on your fingers, this is unary notation.'

  23. 23

    What is the maximum number David Malan claims he can count to on one human hand using a clever method (not simple unary)?

    1. A

      He claims he can count to 10 by using both hands for counting.

    2. B

      He claims he can count to 64 by using complex mathematical rules.

    3. C

      He claims he can count to 31 by considering finger permutations.

    4. D

      He claims he can count to 5 using the simple unary method.

    Correct answer
    C

    He claims he can count to 31 by considering finger permutations.

    Explanation

    31 is as high as I can actually count. And that's because if I actually... because each of my fingers can be down or up and I've got five of them, that's actually 32 possible permutations, up and down. But wait a minute. We said, 31, but if you start at 0. You have to subtract 1 from the biggest possible value.'

  24. 24

    Why is 'binary' (base-2) particularly useful for computers?

    1. A

      Binary maps readily to the real world of electricity being on or off.

    2. B

      Binary is useful because it can represent letters and symbols easily.

    3. C

      Binary allows for faster mathematical calculations than other bases.

    4. D

      Binary is useful because it is the most intuitive for humans to read.

    Correct answer
    A

    Binary maps readily to the real world of electricity being on or off.

    Explanation

    Well, it turns out, when you use base-2, otherwise known as binary, well, it just maps really readily to the real world. Because, at the end of the day... you plug it into the wall because it needs electricity at some point. And what if you have electricity or not? Well, there's your two possible values. Either it's there, or it's not.'

  25. 25

    What is a 'bit' in the context of computer science?

    1. A

      A bit refers to a complex set of instructions for a computer processor.

    2. B

      A bit refers to a small error in a computer program's execution.

    3. C

      A bit is a binary digit, representing a single 0 or 1 value.

    4. D

      A bit is a specialized hardware component used for display graphics.

    Correct answer
    C

    A bit is a binary digit, representing a single 0 or 1 value.

    Explanation

    If you've ever heard this term now, 'bit,' it just means binary digit. A single bit is just a 0 or 1.'

  26. 26

    What are 'transistors' described as in modern computer hardware?

    1. A

      Transistors are specialized input devices for human-computer interaction.

    2. B

      Transistors are tiny switches that turn electricity on or off, representing 0s and 1s.

    3. C

      Transistors are large storage units for holding vast amounts of data.

    4. D

      Transistors are advanced display panels for showing visual output.

    Correct answer
    B

    Transistors are tiny switches that turn electricity on or off, representing 0s and 1s.

    Explanation

    They're called transistors. They've got millions of them in today's hardware. And they're just on or off, like a switch or a light bulb.'

  27. 27

    In the base-10 (decimal) system, what do the column values (ones, tens, hundreds) represent mathematically?

    1. A

      They represent the sum of all digits in the number being processed.

    2. B

      They represent powers of 10 (10 to the 0, 10 to the 1, 10 to the 2).

    3. C

      They represent random multipliers assigned to each digit's position.

    4. D

      They represent the number of digits present in the number.

    Correct answer
    B

    They represent powers of 10 (10 to the 0, 10 to the 1, 10 to the 2).

    Explanation

    This is just 10 to the 0, 10 to the 1, 10 to the 2, ad infinitum.'

  28. 28

    What are the column values in the base-2 (binary) system, analogous to ones, tens, hundreds?

    1. A

      The column values are powers of 2 (2 to the 0, 2 to the 1, 2 to the 2).

    2. B

      The column values are 10, 100, 1000, for each increasing position.

    3. C

      The column values are 1, 2, 3, and so on, in ascending order.

    4. D

      The column values are fixed at 0 and 1, regardless of position.

    Correct answer
    A

    The column values are powers of 2 (2 to the 0, 2 to the 1, 2 to the 2).

    Explanation

    Well, now the math is fundamentally the same. But it's 2 to the 0, 2 to the 1, 2 to the 2, which gives us the ones place, twos place, and fours place.'

  29. 29

    What is the decimal equivalent of a byte of all 1 bits (eight 1s)?

    1. A

      The decimal equivalent of a byte of all 1s is 127.

    2. B

      The decimal equivalent of a byte of all 1s is 1023.

    3. C

      The decimal equivalent of a byte of all 1s is 511.

    4. D

      The decimal equivalent of a byte of all 1s is 255.

    Correct answer
    D

    The decimal equivalent of a byte of all 1s is 255.

    Explanation

    And this byte of all 1 bits—now you've got to do some quick math—represents what number, instead? So it's all 1's; eight of them, total. How about over here, on the end? AUDIENCE: 255. DAVID J. MALAN: So it's, indeed, 255.'

  30. 30

    What is a 'byte' in terms of bits, and why is it a useful unit of measure?

    1. A

      A byte is 16 bits, useful for representing complex graphical data.

    2. B

      A byte is four bits, useful for representing smaller numbers quickly.

    3. C

      A byte is 32 bits, useful for storing entire text documents efficiently.

    4. D

      A byte is eight bits, a more useful unit of measure and a power of 2.

    Correct answer
    D

    A byte is eight bits, a more useful unit of measure and a power of 2.

    Explanation

    AUDIENCE: It's eight bits. DAVID J. MALAN: So it's just eight bits. It's just a more useful unit of measure. And it happens to be a power of 2, 2 to the third, which just makes math work out cleanly.'

  31. 31

    How do computers typically represent letters of the alphabet, such as the capital letter A?

    1. A

      Computers represent letters by analyzing their visual shape directly.

    2. B

      Computers represent letters by assigning a unique pattern of 0s and 1s, often a number.

    3. C

      Computers represent letters by using a complex algorithm to generate them dynamically.

    4. D

      Computers represent letters by converting them into phonetic sounds for storage.

    Correct answer
    B

    Computers represent letters by assigning a unique pattern of 0s and 1s, often a number.

    Explanation

    So we could just assign every letter a number... For various reasons, the humans that designed this system, they went with the number 65. So, nowadays, anytime your computer is showing you the capital letter A on the screen, underneath the hood, so to speak, it's actually storing a pattern of 0's and 1's that represents the number 65.'

  32. 32

    What is the ASCII (American Standard Code for Information Interchange) system primarily used for?

    1. A

      ASCII is primarily used for representing characters in many human languages.

    2. B

      ASCII is primarily used for representing English letters of the alphabet.

    3. C

      ASCII is primarily used for representing mathematical equations.

    4. D

      ASCII is primarily used for representing complex graphical images.

    Correct answer
    B

    ASCII is primarily used for representing English letters of the alphabet.

    Explanation

    So that's it. That's the system known as ASCII, the American Standard Code for Information Interchange. And the A is actually operative there because we're only talking, thus far, about English letters in our alphabet.'

  33. 33

    Why is Unicode a necessary improvement over ASCII for text representation?

    1. A

      Unicode uses fewer bits per character, making files smaller.

    2. B

      Unicode provides better security for sensitive text data than ASCII.

    3. C

      Unicode supports many more characters, including non-English and emoji, unlike ASCII.

    4. D

      Unicode is faster for computers to process than ASCII codes.

    Correct answer
    C

    Unicode supports many more characters, including non-English and emoji, unlike ASCII.

    Explanation

    So Unicode is a superset, so to speak, of ASCII, which is to say that we, humans, realized, some time ago, that just using eight bits to represent letters of the alphabet certainly isn't very good when we want to represent other, non-English languages.' It also supports emoji.

  34. 34

    What is the typical range of bits Unicode might use per character?

    1. A

      Unicode typically uses 64 or 128 bits per character.

    2. B

      Unicode typically uses only 1 bit per character, for efficiency.

    3. C

      Unicode typically uses 8, 16, 24, or 32 bits per character.

    4. D

      Unicode typically uses 4 or 8 bits per character.

    Correct answer
    C

    Unicode typically uses 8, 16, 24, or 32 bits per character.

    Explanation

    So Unicode doesn't just use eight bits. It sometimes uses 16 bits per character, sometimes 24 bits per character, and sometimes even 32 bits per character.'

  35. 35

    How does the Unicode system handle different skin tones for emoji like a 'thumbs up'?

    1. A

      It uses an external image file for each skin tone, referenced by the emoji.

    2. B

      It creates entirely separate unique patterns of 0s and 1s for each skin tone.

    3. C

      It relies on the operating system to automatically determine the correct skin tone.

    4. D

      It represents skin tone as modifying a default color using additional switches.

    Correct answer
    D

    It represents skin tone as modifying a default color using additional switches.

    Explanation

    But you use a few more switches that the computer or phone will interpret as, 'Oh, you don't want to see the default in yellow because of this second number that's in the computer's memory somewhere. You want me to adjust it to be the medium skin tone or any of the other values, instead.'

  36. 36

    What is the purpose of 'zero-width joiners' (ZWNJ characters) in Unicode emoji combinations?

    1. A

      They define the color palette to be used when rendering complex emoji.

    2. B

      They specify the animation sequence for the combined emoji display.

    3. C

      They are special numbers that glue one emoji to another to form a combination.

    4. D

      They indicate the desired size of the combined emoji on the screen.

    Correct answer
    C

    They are special numbers that glue one emoji to another to form a combination.

    Explanation

    These are called zero-width joiners or ZWNJ characters. It just is a special number that humans reserve to say, glue the emoji at the left to the emoji on the right and so forth.'

  37. 37

    How are colors typically represented digitally on computer screens?

    1. A

      Colors are typically represented using CMYK (Cyan, Magenta, Yellow, Black) values.

    2. B

      Colors are typically represented by a series of binary flags for predefined shades.

    3. C

      Colors are typically represented using RGB (Red, Green, Blue) values.

    4. D

      Colors are typically represented by a single numerical code for each color.

    Correct answer
    C

    Colors are typically represented using RGB (Red, Green, Blue) values.

    Explanation

    One of the most common ways is just with RGB—red, green, and blue. It turns out that if we just keep track of how much red should be on the screen, and how much green, and how much blue, combined together, that gives us every color of the rainbow, from white to black and everything in between.'

  38. 38

    What is a 'pixel' on a computer screen, and how many numbers are associated with it for color?

    1. A

      A pixel is a single dot on the screen, storing three numbers for RGB color.

    2. B

      A pixel is a unit of sound, and it has one number associated with its volume.

    3. C

      A pixel is a complex graphic object, and it stores multiple layers of information.

    4. D

      A pixel is a specialized sensor, and it records four numbers for light intensity.

    Correct answer
    A

    A pixel is a single dot on the screen, storing three numbers for RGB color.

    Explanation

    Every one of the dots on your computer screen or your phone screen is called a pixel. And every single dot underneath the hood has three numbers associated with it, so three numbers, three numbers, three numbers for every little dot.'

  39. 39

    How can the same pattern of 0s and 1s be interpreted differently (e.g., as 'Hi!' or 'yellow' color)?

    1. A

      The interpretation depends on the hardware architecture of the device.

    2. B

      The interpretation depends entirely on the context in which the data is used.

    3. C

      The interpretation depends on the specific programming language used to display it.

    4. D

      The interpretation depends on the speed at which the computer processes the data.

    Correct answer
    B

    The interpretation depends entirely on the context in which the data is used.

    Explanation

    But it depends on the context. So if you've received a text message or an email, odds are the pattern of 0's and 1's that the computer is showing you are going to be interpreted as text... If you open the same pattern of 0's and 1's in Photoshop, like a graphics program, they're going to be interpreted, in that context, as colors.'

  40. 40

    How are video files on a computer fundamentally represented?

    1. A

      Video files are fundamentally represented by a series of audio waveforms.

    2. B

      Video files are fundamentally represented as a single, continuous stream of data.

    3. C

      Video files are fundamentally represented as a sequence of many still images.

    4. D

      Video files are fundamentally represented by complex mathematical equations.

    Correct answer
    C

    Video files are fundamentally represented as a sequence of many still images.

    Explanation

    But that's really all a video file is on a computer, lots of pictures moving so quickly in front of us that you and I, our brains, interpolate that as being actual motion.'

  41. 41

    What three aspects could minimally represent music digitally?

    1. A

      Music could be represented by note number, duration, and loudness.

    2. B

      Music could be represented by pitch, rhythm, and tempo of the composition.

    3. C

      Music could be represented by genre, artist, and album information.

    4. D

      Music could be represented by note, instrument type, and recording location.

    Correct answer
    A

    Music could be represented by note number, duration, and loudness.

    Explanation

    AUDIENCE: You could assign a number. DAVID J. MALAN: Yeah, so we can just represent notes by a number... one other number to represent the duration... maybe I can think of a third, the loudness.'

  42. 42

    What is the primary characteristic of the 'divide and conquer' algorithm demonstrated with the phone book?

    1. A

      It involves examining every single page from beginning to end.

    2. B

      It involves looking at two pages at a time and doubling back if needed.

    3. C

      It involves repeatedly halving the problem space to quickly narrow down the search.

    4. D

      It involves randomly selecting pages until the target information is found.

    Correct answer
    C

    It involves repeatedly halving the problem space to quickly narrow down the search.

    Explanation

    We can really divide and conquer this problem by tearing [TEARS BOOK] the problem in half, throwing half of it away, 500 pages away, leaving me with a smaller problem, half as big, that I can really just now repeat.'

  43. 43

    If a phone book has 1,000 pages, approximately how many times can the 'divide and conquer' algorithm be applied to find a specific page?

    1. A

      It can be applied approximately 10 times to get down to one page.

    2. B

      It can be applied approximately 1,000 times to find a page.

    3. C

      It can be applied approximately 500 times to narrow the search.

    4. D

      It can be applied approximately 100 times to find a page.

    Correct answer
    A

    It can be applied approximately 10 times to get down to one page.

    Explanation

    If the phone book does have 1,000 or so pages, how many times can I divide the problem in half to get down to one last page? So it's, roughly, 10.'

  44. 44

    What does a logarithmic shape on an efficiency graph (like the 'divide and conquer' method) signify?

    1. A

      It signifies that the algorithm becomes less efficient with larger problem sizes.

    2. B

      It signifies that time increases very slowly even as problem size grows significantly.

    3. C

      It signifies that problem size has no impact on the time taken.

    4. D

      It signifies a linearly increasing time as problem size grows.

    Correct answer
    B

    It signifies that time increases very slowly even as problem size grows significantly.

    Explanation

    Mathematically, this is called a logarithm... And what this means is that if maybe Cambridge and Allston, here in Massachusetts, merge next year, so we go from 1,000 page phone book to a 2,000 page phone book, that means, if we're here this year, we're over here next year. It's not all that much higher.'

  45. 45

    Can an efficiency graph (like the xy plot discussed) capture the accuracy of an algorithm?

    1. A

      Yes, the graph directly shows the accuracy of the algorithm's output.

    2. B

      Only if the algorithm is perfectly correct will its efficiency be measurable.

    3. C

      The graph only captures accuracy for very small problem sizes, not large ones.

    4. D

      No, the graph primarily speaks to efficiency and design, not correctness.

    Correct answer
    D

    No, the graph primarily speaks to efficiency and design, not correctness.

    Explanation

    A good question. Just to repeat it, can a graph like this capture the accuracy of the algorithm? Short answer, no. For instance, if I drew a straight line that is super low on this graph, which would imply that the algorithm takes the same amount of time, no matter how many pages there are, my algorithm might actually be to just pull a random page from the phone book, one step, and say, here it is. But that's not necessarily going to be accurate, unless I get really, really lucky. So the graph really only speaks to efficiency and the design of the algorithm, not the correctness of it. To analyze the correctness, you need to use another mechanism altogether, namely logic.'

  46. 46

    What is 'pseudocode' described as in the context of problem-solving?

    1. A

      Pseudocode is a compiler that translates human language into machine code directly.

    2. B

      Pseudocode is a formal programming language with strict syntax rules.

    3. C

      Pseudocode is a terse, succinct, and precise description of thoughts in human language.

    4. D

      Pseudocode is a graphical representation of algorithms using flowcharts.

    Correct answer
    C

    Pseudocode is a terse, succinct, and precise description of thoughts in human language.

    Explanation

    So pseudocode has no formal meaning. Generally, you write it in English or whatever your own human language is. But you write your thoughts down tersely, succinct, but precisely.'

  47. 47

    What are 'functions' typically represented as in pseudocode or programming?

    1. A

      Functions are typically represented as conditions that lead to different paths.

    2. B

      Functions are typically represented as decision points that ask questions.

    3. C

      Functions are typically represented as actions or verbs that tell what to do.

    4. D

      Functions are typically represented as iterative cycles repeating steps.

    Correct answer
    C

    Functions are typically represented as actions or verbs that tell what to do.

    Explanation

    Here, in yellow, are what, as of today, we're going to start calling 'functions,' technically speaking. These are like actions or verbs that literally, in this case, tell me what to do.'

  48. 48

    What is a 'Boolean expression' in programming, and what kind of answer does it provide?

    1. A

      A Boolean expression is a mathematical calculation that returns a numerical value.

    2. B

      A Boolean expression is a command that directly performs an action within the program.

    3. C

      A Boolean expression is a statement that defines a new variable for storage.

    4. D

      A Boolean expression is a question that results in a yes/no, true/false, or 1/0 answer.

    Correct answer
    D

    A Boolean expression is a question that results in a yes/no, true/false, or 1/0 answer.

    Explanation

    And a Boolean expression is essentially just a question with a yes/no answer, a true or false answer, a 1 or 0 answer. It doesn't matter how you think about it, but it's got two possible answers.'

  49. 49

    What does 'Go back to line 3' represent in the pseudocode for the phone book algorithm?

    1. A

      It represents an unconditional jump to a specific part of the program.

    2. B

      It represents a syntax error that needs to be corrected by the programmer.

    3. C

      It represents a 'loop,' a kind of cycle that repeats certain actions.

    4. D

      It represents a function call to a predefined external module.

    Correct answer
    C

    It represents a 'loop,' a kind of cycle that repeats certain actions.

    Explanation

    And lastly, there's this, 'Go back to line 3,' in two different places. That represents what we call a 'loop,' some kind of cycle that's doing something again and again.'

  50. 50

    What type of software are 'chatbots' like the CS50 duck?

    1. A

      Chatbots are interactive graphical programs that display complex animations.

    2. B

      Chatbots are interactive text-based programs that talk and answer questions.

    3. C

      Chatbots are programs designed solely for data analysis and statistical modeling.

    4. D

      Chatbots are operating systems that manage computer hardware resources.

    Correct answer
    B

    Chatbots are interactive text-based programs that talk and answer questions.

    Explanation

    So the class will still be taught by us humans, but helped by this CS50 duck, a chatbot of sorts. Now what do I mean by this? Well, it turns out that, when it comes to implementing something like an artificial intelligence, we don't quite have all of the building blocks yet.'

  51. 51

    What is the primary input for 'large language models' (LLMs)?

    1. A

      The primary input for LLMs is visual information, such as images and videos.

    2. B

      The primary input for LLMs is structured numerical data from databases.

    3. C

      The primary input for LLMs is vast amounts of human language text data.

    4. D

      The primary input for LLMs is direct instructions from human programmers.

    Correct answer
    C

    The primary input for LLMs is vast amounts of human language text data.

    Explanation

    And a large language model really is an implementation, in software, of code that actually takes, as input, lots and lots of language—like the text of lots and lots of web pages, dictionaries, encyclopedias, Wikipedias, and the like.'

  52. 52

    What is the approach of CS50 regarding the use of AI-based software for assignments?

    1. A

      Students are allowed to use only CS50's own AI-based software, like the CS50 duck.

    2. B

      Students are encouraged to use any AI-based software to complete assignments quickly.

    3. C

      Students must fully document all interactions with AI tools for grading.

    4. D

      Students are strictly prohibited from using any AI-based software in the course.

    Correct answer
    A

    Students are allowed to use only CS50's own AI-based software, like the CS50 duck.

    Explanation

    So it will not be allowed, it will be considered not reasonable to use AI-based software, other than CS50's own.'

  53. 53

    What is the personality of the CS50 duck chatbot designed to be like?

    1. A

      The CS50 duck chatbot has the personality of a strict, unyielding professor.

    2. B

      The CS50 duck chatbot has the personality of a CS50 teaching fellow and thinks of itself as a duck.

    3. C

      The CS50 duck chatbot has the personality of an industry CEO giving directives.

    4. D

      The CS50 duck chatbot has the personality of a student who has mastered all course concepts.

    Correct answer
    B

    The CS50 duck chatbot has the personality of a CS50 teaching fellow and thinks of itself as a duck.

    Explanation

    CS50.ai, a web-based application that's quite similar to ChatGPT, but that has the personality of a CS50 teaching fellow or TF, or teaching assistant, TA, that also happens to think of itself as a duck.'

  54. 54

    Why is 'Scratch' introduced in CS50 as a programming language?

    1. A

      Scratch is introduced because it is widely used in professional web development.

    2. B

      Scratch is introduced for students to specialize in game design and animation.

    3. C

      Scratch is introduced as the primary language for advanced software development.

    4. D

      Scratch is introduced to provide visual representations of programming ideas.

    Correct answer
    D

    Scratch is introduced to provide visual representations of programming ideas.

    Explanation

    But we'll use it today for just a bit. And we'll use it in the course's first homework, AKA problem set 0, to explore now some of these same ideas. And among the goals today for the remainder of today is not to focus so much on Scratch and the particulars because this is not a language that you're going to use often but to give you very visual representations of ideas so that when things do escalate next week to C, to the more cryptic, it's the same ideas just typed out instead of dragged and dropped.'

  55. 55

    What are 'parameters' or 'arguments' in programming functions?

    1. A

      They are mandatory outputs that all functions must produce.

    2. B

      They are inputs that customize the behavior of a function.

    3. C

      They are error messages displayed when a function encounters an issue.

    4. D

      They are decorative elements that enhance the visual appeal of functions.

    Correct answer
    B

    They are inputs that customize the behavior of a function.

    Explanation

    These white ovals that take textual input—in general, those are called parameters or arguments. And they customize the behavior of a function. So a parameter or an argument customizes, modifies the default behavior of a function, like in this case, say.'

  56. 56

    What is a 'return value' in the context of programming functions?

    1. A

      A return value is a temporary variable that stores internal function data.

    2. B

      A return value is an error code indicating a function's failure.

    3. C

      A return value is some value conceptually handed back from a function to be used.

    4. D

      A return value is a visual output displayed on the screen by a function.

    Correct answer
    C

    A return value is some value conceptually handed back from a function to be used.

    Explanation

    A return value is some value that can be handed back to you conceptually from a function so that you can do something with it.'

  57. 57

    What is 'abstraction' in programming, as demonstrated with the 'meow' block in Scratch?

    1. A

      Abstraction is simplifying, caring only about what a function does, not its details.

    2. B

      Abstraction is duplicating code to ensure redundancy and fault tolerance.

    3. C

      Abstraction is making code more complex to handle advanced scenarios.

    4. D

      Abstraction is the process of converting code from one language to another.

    Correct answer
    A

    Abstraction is simplifying, caring only about what a function does, not its details.

    Explanation

    This idea of abstraction, something we're going to use frequently. To abstract something away is to simplify. Don't think about the underlying implementation details. Just care about what it does or what it's called.'

  58. 58

    What is the common issue when a program that relies on continuous checks (like mouse touching cat) only checks once?

    1. A

      It will always produce the correct result, but with a slight delay.

    2. B

      The program will crash due to an infinite loop immediately.

    3. C

      The program may appear unresponsive because it only checked at startup.

    4. D

      It leads to a syntax error, preventing the program from running.

    Correct answer
    C

    The program may appear unresponsive because it only checked at startup.

    Explanation

    AUDIENCE: It only checks once. DAVID J. MALAN: Once. So I click the green flag. The computer did what I told it to do. The mouse pointer was not touching the cat at that moment because it was touching the green flag. So, of course, it didn't meow.' The fix was to use a 'forever' loop.

  59. 59

    How did the speaker manage to get the trash can lid to open and close in the 'Oscartime' game?

    1. A

      He toggled between two different 'costumes' (images) for Oscar: lid up and lid down.

    2. B

      He coded a complex sequence of movements for the lid using many small steps.

    3. C

      He used advanced physics simulations to animate the lid realistically.

    4. D

      He had multiple sprites for the lid, animating them frame by frame.

    Correct answer
    A

    He toggled between two different 'costumes' (images) for Oscar: lid up and lid down.

    Explanation

    I changed Oscar's costume, his appearance, to be just number one... And then I forever did this. If Oscar is touching the mouse pointer, then change Oscar's costume to number two, otherwise change it back to one. So it's super simple animation. I'm just toggling between lid up, lid down, lid up, lid down.'

  60. 60

    Why did the speaker make the trash reappear at the top of the screen after it touched Oscar's trash can?

    1. A

      To prevent the game from ending prematurely by having too much trash fall.

    2. B

      To create the illusion that the trash disappeared into the can and more fell.

    3. C

      To simulate the trash being recycled and returning to the game.

    4. D

      To add a challenge by making players anticipate where the trash would land.

    Correct answer
    B

    To create the illusion that the trash disappeared into the can and more fell.

    Explanation

    Forever if the trash is touching Oscar, what should it do? Go to a completely different x and y location at the very top. Why? Well, as soon as I drag the trash over the Oscar, I want it to disappear as though it's going into the can. And I then want it to reappear at the top so more trash falls.'

  61. 61

    What is the recommended approach for building a complex program or game, as demonstrated by 'Oscartime'?

    1. A

      Break down the grand vision into small, incremental 'baby steps' and build version by version.

    2. B

      Focus solely on the graphical design first, then add all functionality at the end.

    3. C

      Use only pre-made functions and avoid creating any custom programming blocks.

    4. D

      Attempt to implement the entire program with all features simultaneously.

    Correct answer
    A

    Break down the grand vision into small, incremental 'baby steps' and build version by version.

    Explanation

    But you don't try to implement version 10 or 20 at the get-go. You take those incremental steps.'

  62. 62

    Why were the 'left wall' and 'right wall' implemented as separate sprites in the Harvard shield game?

    1. A

      They were implemented as sprites to act as static obstacles that the shield could not pass.

    2. B

      They were implemented as sprites to allow the shield to interact with them via 'touching' Boolean expressions.

    3. C

      They were implemented as sprites to define the background of the game world.

    4. D

      They were implemented as sprites purely for decorative visual appeal.

    Correct answer
    B

    They were implemented as sprites to allow the shield to interact with them via 'touching' Boolean expressions.

    Explanation

    Why did I implement those as sprites? Why do they need to exist as entities themselves? Yeah, in front. AUDIENCE: [INAUDIBLE] DAVID J. MALAN: Yeah. I want it to interact with the shield. So I need to be able to ask that Boolean expression, like, not touching mouse pointer but touching shield, for instance, a different type of yes/no question.'

  63. 63

    What common programming problem was illustrated when the Yale logo moved too fast and passed through the walls?

    1. A

      It illustrated a runtime error caused by insufficient memory allocation.

    2. B

      It illustrated a syntax error because the movement speed was too high.

    3. C

      It illustrated a logic error where the collision detection was not instant enough.

    4. D

      It illustrated a design flaw where the game became too easy for the player.

    Correct answer
    C

    It illustrated a logic error where the collision detection was not instant enough.

    Explanation

    Uh-oh. So what just happened? That is a bug... Because I'm doing 100 steps at a time, I'm never actually touching the other sprite because I'm sort of stepping way over it. So there's never a moment where they're actually touching.' This is a common logic or collision detection issue.

Question 1 of 63
Question 1 of 63

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent