1. Home
  2. Explore
  3. Computer Science
  4. Introduction to Programming

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Content

Introduction to Programming

  • 82Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Binary and Abstraction
The only language that machines ultimately understand is
.

82 questions

  1. 1
    The only language that machines ultimately understand is
    _____
    .
    Hint

    This language is composed of only two digits: 0s and 1s.

    Answer

    binary

  2. 2
    In the context of computer science, problem-solving can be distilled into having inputs, wanting outputs, and needing to do something with those inputs in the
    _____
    .
    Hint

    This refers to the process or algorithm that transforms the initial data.

    Answer

    middle

  3. 3
    At its most basic level, a computer's only input is electricity, which can be thought of as existing in two states: 1 or 0, true or
    _____
    .
    Hint

    This describes the fundamental logical states of binary information.

    Answer

    false

  4. 4
    ASCII is a global standard used for mapping numbers to
    _____
    .
    Hint

    This standard allows computers to represent text characters using numerical values.

    Answer

    letters

  5. 5
    In a graphics program, numerical values like 72, 73, and 33 can be interpreted as amounts of red, green, and
    _____
    to represent colors.
    Hint

    This is a common color model used in digital imaging.

    Answer

    blue

  6. 6
    Videos and movies are essentially sequences of
    _____
    flying past your human eyes very quickly.
    Hint

    This describes how motion is created in digital media.

    Answer

    images

  7. 7
    The value of
    _____
    in computer science allows us to assume that underlying complex details are handled by someone else, so we don't need to think at that low level.
    Hint

    This concept involves hiding complex implementation details and showing only the essential information.

    Answer

    abstraction

  8. 8
    The 'secret sauce' inside a 'black box' where problems are actually solved are called
    _____
    .
    Hint

    These are step-by-step procedures for solving a problem.

    Answer

    algorithms

  9. 9
    An algorithm that involves turning the phone book page by page one at a time would be represented graphically as a
    _____
    line due to its one-to-one correspondence between pages and turns.
    Hint

    This indicates a linear relationship in terms of efficiency.

    Answer

    straight

  10. 10
    The dividing and conquer algorithm, like opening a phone book to the middle and repeating the process, focuses on improving
    _____
    .
    Hint

    This strategy aims to solve problems faster.

    Answer

    efficiency

  11. 11
    To express algorithms more precisely, we use
    _____
    , which is English-like, succinct, and gets the point across without formal definition.
    Hint

    This is an informal high-level description of an algorithm.

    Answer

    pseudocode

  12. 12
    Concepts like loops, conditions, Boolean expressions, and variables serve as
    _____
    for building programs.
    Hint

    These are fundamental components used in programming languages.

    Answer

    building blocks

  13. 13
    Statements like 'open to the middle of the phone book' or 'call Mike' are examples of
    _____
    that are useful but require more detailed instructions for a computer.
    Hint

    These statements hide complex underlying steps.

    Answer

    abstractions

  14. 14
    The peanut butter and jelly sandwich exercise demonstrated how many
    _____
    are often made in human communication that would cause a computer program to fail without explicit instructions.
    Hint

    This highlights the need for precision when programming.

    Answer

    assumptions

  15. 15
    If a programmer does not handle 'corner cases' or think about the precise meaning of an instruction, the program may
    _____
    .
    Hint

    This describes a common outcome of a lack of specificity or precision in code.

    Answer

    crash

  16. 16
    Creating your own 'puzzle pieces' or custom blocks in Scratch, like the 'cough' example, is useful because it allows you to reuse that
    _____
    without worrying about its implementation details.
    Hint

    This concept allows you to simplify complex operations once they are defined.

    Answer

    abstraction

  17. 17
    The text-based programming language introduced as an older, more traditional alternative to Scratch is
    _____
    .
    Hint

    This language is known for its power and control over hardware.

    Answer

    C

  18. 18
    The C code printf("hello, world\n"); when executed, simply prints the phrase 'hello world' to the
    _____
    .
    Hint

    This is a common output operation in programming.

    Answer

    screen

  19. 19
    When transitioning from Scratch to C, it is important to understand that while syntax may be frustrating, the underlying
    _____
    are the most important takeaway.
    Hint

    Focus on the core concepts, not just the specific keywords and symbols.

    Answer

    principles

  20. 20
    In programming, a 'function' is generally considered a
    _____
    or an action that has functionality built into it.
    Hint

    Think about what a function does.

    Answer

    verb

  21. 21
    In C, the function to print formatted text is called `
    _____
    `, where the 'f' stands for formatted.
    Hint

    This is the primary output function in C.

    Answer

    printf

  22. 22
    In C, strings that are passed to printf must be surrounded by double
    _____
    .
    Hint

    This is a syntactic requirement for literal strings in C.

    Answer

    quotes

  23. 23
    To move the cursor to the next line on the screen in C, you need to explicitly tell the computer by typing `
    _____
    `.
    Hint

    This is an escape sequence for a newline character.

    Answer

    \n

  24. 24
    Most lines of code in C must end with a
    _____
    as the equivalent of a period in an English sentence.
    Hint

    This punctuation mark indicates the end of a statement.

    Answer

    semi-colon

  25. 25
    In C, the backslash character is used as an
    _____
    character when you want to show information in a slightly different way, such as \n for a newline.
    Hint

    This character changes the interpretation of the following character.

    Answer

    escape

  26. 26
    A 'variable' in programming, similar to x and y in algebra, is a
    _____
    for data.
    Hint

    It's a named storage location for values.

    Answer

    placeholder

  27. 27
    When declaring a variable in C, you must specify its
    _____
    , such as int for an integer.
    Hint

    This tells the computer what kind of data the variable will store.

    Answer

    type

  28. 28
    In C, the = symbol is used for
    _____
    , meaning it copies the value on the right into the variable on the left.
    Hint

    This operator gives a value to a variable.

    Answer

    assignment

  29. 29
    The shorthand counter += 1 in C is an example of
    _____
    sugar, allowing you to write counter = counter + 1 more succinctly.
    Hint

    This refers to features that make code easier or shorter to write without changing functionality.

    Answer

    syntactic

  30. 30
    The even more succinct way to increment a variable by 1 in C is `counter
    _____
    `.
    Hint

    This is a common unary operator for increasing a variable's value by one.

    Answer

    ++

  31. 31
    In Scratch, an 'if' block represents a
    _____
    , which can be translated directly to if in C.
    Hint

    This construct allows a program to make decisions.

    Answer

    condition

  32. 32
    In C, a Boolean expression within an if statement must be enclosed in
    _____
    .
    Hint

    These symbols are required around the condition being tested.

    Answer

    parentheses

  33. 33
    Curly braces ({}) in C are used to group multiple lines of code, similar to the embracing shape of
    _____
    blocks in Scratch.
    Hint

    These blocks in Scratch define a code block that executes together.

    Answer

    yellow

  34. 34
    In C, to check for equality, you must use a double equal sign (`
    _____
    `) to distinguish it from the assignment operator.
    Hint

    This is the comparison operator for determining if two values are the same.

    Answer

    ==

  35. 35
    When comparing two integers, x and y, there are exactly
    _____
    possible cases: less than, greater than, or equal to.
    Hint

    Consider all logical possibilities.

    Answer

    three

  36. 36
    Optimizing if-else if-else if statements by removing the final else if for equality and replacing it with just else saves the computer
    _____
    .
    Hint

    This reduces redundant checks.

    Answer

    time

  37. 37
    In C, the keyword `
    _____
    ` is used to create a loop that repeats actions, similar to Scratch's 'forever' block.
    Hint

    This loop continues as long as a condition is true.

    Answer

    while

  38. 38
    To create an infinite loop in C using while, the condition inside the parentheses should be `
    _____
    `.
    Hint

    This keyword always evaluates to a positive logical state.

    Answer

    true

  39. 39
    In C, the convention for starting to count in programming is typically from
    _____
    .
    Hint

    This relates to the smallest representable binary value.

    Answer

    0

  40. 40
    A 'string' in a programming language is simply a sequence of
    _____
    .
    Hint

    It's how words, phrases, or paragraphs are represented.

    Answer

    characters

  41. 41
    The printf function in C can take multiple inputs; the first is the format string, and subsequent inputs are
    _____
    to be plugged into placeholders.
    Hint

    These provide the actual data for the format specifiers.

    Answer

    variables

  42. 42
    In C, the placeholder %s in a format string is used to indicate where a
    _____
    should be substituted.
    Hint

    This format code stands for a sequence of characters.

    Answer

    string

  43. 43
    The CS50 Sandbox is a cloud-based application that provides a standardized
    _____
    environment for writing and running code.
    Hint

    It's an online tool for practicing coding without local setup issues.

    Answer

    programming

  44. 44
    The main function in C is the equivalent of Scratch's '
    _____
    clicked' block, indicating where the program execution begins.
    Hint

    This is the entry point of a C program.

    Answer

    when green flag

  45. 45
    Source code, written in languages like C, needs to be converted into
    _____
    code (zeros and ones) for the machine to understand.
    Hint

    This is the low-level binary language processed by the CPU.

    Answer

    machine

  46. 46
    A
    _____
    is a program that allows us to convert source code into machine code.
    Hint

    This tool translates high-level code into low-level instructions.

    Answer

    compiler

  47. 47
    The blinking prompt with a dollar sign in the CS50 Sandbox indicates a
    _____
    window, where users type commands to the computer.
    Hint

    This is a text-based interface for interacting with the operating system.

    Answer

    terminal

  48. 48
    To compile a C program named hello.c, the command clang hello.c is used, where clang is the
    _____
    .
    Hint

    This is the specific program that translates C code.

    Answer

    compiler

  49. 49
    After compilation, the executable machine code is conventionally stored in a file called `
    _____
    `.
    Hint

    This is the default output file name for many C compilers.

    Answer

    a.out

  50. 50
    To run an executable file named a.out in a Linux environment, you type `
    _____
    `.
    Hint

    This command specifies to execute the file in the current directory.

    Answer

    ./a.out

  51. 51
    To specify the output filename for a compiled program, the -o flag is used with the compiler, as in `clang -o hello
    _____
    `.
    Hint

    This is the source code file that needs to be compiled.

    Answer

    hello.c

  52. 52
    The make command automates the compilation process by looking for a source file named `
    _____
    ` by default, saving the programmer from typing complex commands.
    Hint

    This command assumes a conventional naming for C source files.

    Answer

    hello.c

  53. 53
    When encountering cryptic error messages during compilation, it's most important to start debugging by looking at the
    _____
    of the error output.
    Hint

    Initial errors often cause a cascade of subsequent, misleading errors.

    Answer

    top

  54. 54
    In C, string is not a built-in
    _____
    , but rather a type provided by libraries like CS50.h.
    Hint

    This refers to a category of data that a variable can hold.

    Answer

    type

  55. 55
    The stdio.h (standard input/output header) file provides access to handy features like the `
    _____
    ` function.
    Hint

    This function is used for output to the console.

    Answer

    printf

  56. 56
    The input to a function is typically called an argument or a
    _____
    .
    Hint

    These are values passed to a function when it is called.

    Answer

    parameter

  57. 57
    Random Access Memory (RAM) is a type of
    _____
    storage, used by programs while they are running.
    Hint

    Data stored here is lost when power is off.

    Answer

    temporary

  58. 58
    In a computer, 'floats' or floating-point values are numbers that can have
    _____
    points.
    Hint

    These numbers are used to represent non-integer values.

    Answer

    decimal

  59. 59
    The placeholder %i in a printf format string is used to substitute an
    _____
    .
    Hint

    This format code is for whole numbers.

    Answer

    integer

  60. 60
    For multiplication in C, the `
    _____
    ` (asterisk) symbol is used instead of 'x'.
    Hint

    This is a common symbol for multiplication in programming.

    Answer
  61. 61
    The % operator in C performs
    _____
    arithmetic, returning the remainder of a division.
    Hint

    This operator is sometimes called the 'remainder operator'.

    Answer

    modular

  62. 62
    When dividing two integers in C, such as 2 / 10, the result will be 0 because it performs
    _____
    arithmetic, truncating any decimal part.
    Hint

    The data type of the operands determines the type of the result.

    Answer

    integer

  63. 63
    Representing an infinite number of real numbers with a finite amount of computer memory inevitably leads to
    _____
    .
    Hint

    Computers cannot store every digit of every number.

    Answer

    imprecision

  64. 64
    A `
    _____
    in C is a data type that uses 32 bits of space, while adouble` uses twice as many bits (64 bits) for greater precision.
    Hint

    This is a single-precision floating-point type.

    Answer

    float

  65. 65
    When using printf with a float or double, you can specify the number of decimal places to display by using `%.
    _____
    f, where N` is the number of decimal places.
    Hint

    This is a format specifier for controlling floating-point output.

    Answer

    N

  66. 66
    Comparing floating-point values for strict `
    _____
    ` in code is generally discouraged due to potential imprecision.
    Hint

    Due to rounding errors, two floating-point numbers that should be the same might differ slightly.

    Answer

    equality

  67. 67
    The term 'parity' in the context of numbers refers to whether a number is even or
    _____
    .
    Hint

    This classification is based on divisibility by two.

    Answer

    odd

  68. 68
    In C, the || (double vertical bar) operator represents a logical
    _____
    , meaning 'either this OR that'.
    Hint

    This operator combines conditions, where at least one must be true.

    Answer

    OR

  69. 69
    When creating custom functions in C, you must declare a
    _____
    for the function before it is used in main or elsewhere in the code.
    Hint

    This provides a forward declaration of the function's signature.

    Answer

    prototype

  70. 70
    The void keyword when used as a function's return type indicates that the function does not
    _____
    any value.
    Hint

    This means the function performs an action but doesn't hand back data.

    Answer

    return

  71. 71
    The void keyword used inside the parentheses of a function's declaration (e.g., int main(void)) indicates that the function does not take any
    _____
    .
    Hint

    This means the function doesn't accept any arguments.

    Answer

    inputs

  72. 72
    If a computer's hardware only has space for three digits, 999 + 1 would result in 0 due to integer
    _____
    .
    Hint

    This occurs when a number becomes too large for its assigned storage space.

    Answer

    overflow

  73. 73
    In C, // is used to denote a
    _____
    on a single line.
    Hint

    This is for human-readable notes in the code.

    Answer

    comment

  74. 74
    The sleep function, which pauses program execution for a specified number of seconds, has its prototype declared in `
    _____
    `.
    Hint

    This header file provides access to various POSIX operating system API functions.

    Answer

    unistd.h

  75. 75
    The `
    _____
    operator in C doubles the value of a variable, similar toi = i * 2`.
    Hint

    This is a compound assignment operator for multiplication.

    Answer

    *=

  76. 76
    The Y2K problem was primarily caused by programmers using only two digits to store the
    _____
    , leading to potential confusion with the year 1900.
    Hint

    This was a millennium bug related to date formatting.

    Answer

    year

  77. 77
    Integer
    _____
    occurs when a number becomes too small for its assigned storage space, leading to a wrap-around to the maximum representable value.
    Hint

    This is the opposite of overflow, often resulting in a large positive number from a small negative one.

    Answer

    underflow

  78. 78
    The do-while loop in C guarantees that the code block will execute at least
    _____
    before checking the condition.
    Hint

    Unlike a while loop, the condition is evaluated after the first iteration.

    Answer

    once

  79. 79
    In C, the return keyword is used to send a
    _____
    back from a function to the code that called it.
    Hint

    This terminates the function execution and provides an output.

    Answer

    value

  80. 80
    Variables in C have
    _____
    , meaning they only exist and are accessible within the curly braces between which they were declared.
    Hint

    This defines the region of a program where a variable can be used.

    Answer

    scope

  81. 81
    A 'long' is a
    _____
    -bit integer, offering a larger range of values compared to a typical 32-bit integer.
    Hint

    This data type uses twice the storage of a standard integer.

    Answer

    64

  82. 82
    In the game Civilization, Gandhi's aggression level would loop around to 255 (very aggressive) if it was reduced below 0, an example of integer
    _____
    .
    Hint

    This bug occurred because of how a single byte of memory was handled.

    Answer

    underflow

1 of 82
Question 1 of 82

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesContent