1. Home
  2. Explore
  3. Computer Science
  4. C Programming Fundamentals

Study methods

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

C Programming Fundamentals

  • 127Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: C Foundations
C is described as one of the
programming languages still in use.

127 questions

  1. 1
    C is described as one of the
    _____
    programming languages still in use.
    Hint

    The content compares its age with that of modern languages.

    Answer

    oldest

    Explanation

    C is described as one of the oldest programming languages around.

  2. 2
    Many modern programming languages are based on
    _____
    Hint

    This is the language whose fundamentals the material introduces.

    Answer

    C

    Explanation

    The content notes that many modern programming languages are based on C.

  3. 3
    Although their names are similar, C and
    _____
    are different programming languages.
    Hint

    This language is often learned after C fundamentals.

    Answer

    C++

    Explanation

    The content explicitly distinguishes C and C++ as separate programming languages.

  4. 4
    Learning C fundamentals can provide a useful foundation for someone who wants to learn
    _____
    Hint

    It is the other language mentioned alongside C.

    Answer

    C++

    Explanation

    The content recommends learning C basics even for people interested in C++.

  5. 5
    A C program consists of instructions that a programmer writes for the
    _____
    to carry out.
    Hint

    The instructions are intended to make this device do something.

    Answer

    computer

    Explanation

    A program is a set of instructions that, when executed, causes the computer to perform tasks.

  6. 6
    Before a computer can execute C instructions, a
    _____
    translates them into a language the computer can understand.
    Hint

    This is one of the two essential tools needed to program in C.

    Answer

    C compiler

    Explanation

    A C compiler translates or transforms C code into a form the computer can execute.

  7. 7
    A basic text editor is sufficient for writing C if it can write text and save it in a specific
    _____
    Hint

    The saved text must be stored in a form appropriate for the source file.

    Answer

    file format

    Explanation

    The content says any editor that can write text and save it in a specific file format can be used.

  8. 8
    An IDE is a specialized environment that can help programmers write, run, and
    _____
    C programs.
    Hint

    It supports more than just editing the source code.

    Answer

    manage

    Explanation

    An integrated development environment provides tools to write, run, and manage programs.

  9. 9
    Code::Blocks is an example of an
    _____
    used to write C programs.
    Hint

    The abbreviation stands for integrated development environment.

    Answer

    IDE

    Explanation

    Code::Blocks is presented as an IDE for writing and working with C programs.

  10. 10
    The two basic tools needed to begin programming in C are a text editor or IDE and a
    _____
    Hint

    One tool is for writing source code; the other translates it.

    Answer

    C compiler

    Explanation

    The content identifies a writing environment and a C compiler as the two necessary tools.

  11. 11
    On Windows, the Code::Blocks installer option that includes MinGW can install both the IDE and a
    _____
    Hint

    MinGW is included so the computer can translate C code.

    Answer

    C compiler

    Explanation

    The described Windows installer bundles Code::Blocks with a compiler through MinGW.

  12. 12
    On a Mac, the
    _____
    lets a programmer interact with the computer using text commands.
    Hint

    It is launched by searching for its name in the system search bar.

    Answer

    terminal

    Explanation

    The terminal is a program for interacting with the computer through text commands.

  13. 13
    The command cc -v is used on a Mac to check whether a
    _____
    is installed.
    Hint

    The command displays version information when the tool is available.

    Answer

    C compiler

    Explanation

    Running cc -v checks for an installed C compiler and can display its version information.

  14. 14
    On a Mac, xcode-select --install installs the command line tools needed to get a
    _____
    working.
    Hint

    The command is used if the compiler is not already installed.

    Answer

    C compiler

    Explanation

    The content describes this command as a way to install the tools needed for the C compiler.

  15. 15
    In Code::Blocks, a basic C project that runs on a computer can be created as a
    _____
    Hint

    It is the basic project type selected in the project wizard.

    Answer

    console application

    Explanation

    The tutorial selects a console application for a simple C project.

  16. 16
    When creating a Code::Blocks project for this course, the programmer selects
    _____
    rather than C++.
    Hint

    These are the two language choices shown in the wizard.

    Answer

    C

    Explanation

    The project wizard offers C and C++; the tutorial chooses C.

  17. 17
    Code::Blocks automatically creates a source file named
    _____
    for a new project.
    Hint

    It is located in the project's source folder.

    Answer

    main.c

    Explanation

    The tutorial identifies main.c as the source file automatically created by Code::Blocks.

  18. 18
    The default program supplied in a new C project prints
    _____
    onto the screen.
    Hint

    It is the conventional first-program message.

    Answer

    Hello world

    Explanation

    The default C program is described as printing Hello world.

  19. 19
    In Code::Blocks, a program must be
    _____
    before it can be run.
    Hint

    This step compiles the source code into executable code.

    Answer

    built

    Explanation

    Code::Blocks prompts the user to build the project before running it if it has not been built.

  20. 20
    In Code::Blocks, the combined command that builds a program and then executes it is called
    _____
    Hint

    It combines the two steps required to test a program.

    Answer

    build and run

    Explanation

    The build and run option compiles the program and executes it in one step.

  21. 21
    The function that is executed when a C program starts is named
    _____
    Hint

    It is the function included in every basic C program in the tutorial.

    Answer

    main

    Explanation

    Execution begins in the main function, which is the program's starting point.

  22. 22
    The code executed by a function is placed between its opening and closing
    _____
    Hint

    These symbols enclose the function body.

    Answer

    curly brackets

    Explanation

    The computer executes the code inside the function's curly brackets.

  23. 23
    In a basic program, #include lines appear near the top of the file and are needed for the program to
    _____
    Hint

    The tutorial says to keep them even before explaining their details.

    Answer

    work

    Explanation

    The content advises that the include instructions are needed for the program to work, while their details are covered later.

  24. 24
    Each C instruction is normally ended with a
    _____
    to mark that the instruction is complete.
    Hint

    This punctuation appears at the end of statements such as printf.

    Answer

    semicolon

    Explanation

    A semicolon tells C that the current instruction is finished and the next one can begin.

  25. 25
    When a C program executes multiple instructions in sequence, their
    _____
    can change the program's output.
    Hint

    Moving one instruction earlier can make it run first.

    Answer

    order

    Explanation

    The computer executes instructions in order, so changing their order can change the result.

  26. 26
    The process of translating C source code into code the computer can understand is called
    _____
    Hint

    It happens before the compiled program is executed.

    Answer

    building or compiling

    Explanation

    Building or compiling translates the C code into a form the computer can execute.

  27. 27
    After a program has been built, the computer must
    _____
    the resulting code to carry out its instructions.
    Hint

    This is the second step after compilation.

    Answer

    run

    Explanation

    Running a program tells the computer to execute the code produced by the build step.

  28. 28
    The output window that displays text printed by a basic C program is often called the
    _____
    Hint

    It is also described as a command prompt window in the tutorial.

    Answer

    console

    Explanation

    The console displays information that a program prints to the screen.

  29. 29
    A printf instruction can produce a new line by including the escape sequence
    _____
    in its text.
    Hint

    It begins with a backslash and represents a line break.

    Answer

    \n

    Explanation

    The \n escape sequence moves subsequent printed text onto a new line.

  30. 30
    A variable is a container used to store a piece of
    _____
    in a program.
    Hint

    Examples include numbers, text, and characters.

    Answer

    information

    Explanation

    Variables hold data values so programs can keep track of and use information.

  31. 31
    Giving variables descriptive names helps programmers recognize what information each variable
    _____
    Hint

    A name such as character age indicates the contents of the container.

    Answer

    stores

    Explanation

    Descriptive variable names make it easier to understand what each variable contains.

  32. 32
    When declaring a variable in C, the programmer specifies its data type and its
    _____
    Hint

    For example, a declaration identifies both what it stores and what it is called.

    Answer

    name

    Explanation

    A variable declaration specifies the type of information to store and the variable's name.

  33. 33
    The C data type used for whole numbers is
    _____
    Hint

    It stands for integer.

    Answer

    int

    Explanation

    An integer is a whole number, and C uses int for this basic type.

  34. 34
    A number such as 3.7, which has a decimal point, can be represented with the C type
    _____
    Hint

    The tutorial recommends this decimal type for beginners.

    Answer

    double

    Explanation

    A double represents a decimal number; the tutorial recommends it for most beginner uses.

  35. 35
    The other basic decimal-number type mentioned alongside double is
    _____
    Hint

    Both it and double can represent numbers with decimal points.

    Answer

    float

    Explanation

    C has both float and double types for decimal numbers.

  36. 36
    In C, 40 is an integer, whereas 40.0 is a
    _____
    Hint

    The decimal point changes how the literal is treated.

    Answer

    double

    Explanation

    A number without a decimal point is an integer; a number written with one is a decimal value such as a double.

  37. 37
    The data type used to store one single character in C is
    _____
    Hint

    Its name is short for character.

    Answer

    char

    Explanation

    A char variable holds one character, such as a letter or symbol.

  38. 38
    A character literal such as the letter A is written between
    _____
    quotation marks.
    Hint

    These are different from the marks used around a string.

    Answer

    single

    Explanation

    A single character is specified using single quotation marks in C.

  39. 39
    A string in C is a
    _____
    of characters grouped together.
    Hint

    It can represent a word, name, or phrase rather than just one character.

    Answer

    collection

    Explanation

    A string is a collection of characters; in C it can be represented using a character array.

  40. 40
    A character array used to store a string is declared with char and
    _____
    after its name.
    Hint

    They indicate that the variable stores multiple characters.

    Answer

    square brackets

    Explanation

    The square brackets indicate that the character variable is an array capable of holding multiple characters.

  41. 41
    A string literal such as a phrase is written between
    _____
    quotation marks.
    Hint

    This is the quotation style used for a sequence of characters.

    Answer

    double

    Explanation

    Strings use double quotation marks, unlike single-character literals, which use single quotation marks.

  42. 42
    A constant variable is a value that
    _____
    be modified after it is declared.
    Hint

    The const keyword marks this restriction.

    Answer

    cannot

    Explanation

    A constant cannot be changed during the program's execution.

  43. 43
    The keyword used to declare a constant variable in C is
    _____
    Hint

    It is placed before the variable's type in the example.

    Answer

    const

    Explanation

    The const keyword marks a variable as unchangeable.

  44. 44
    A common naming convention for constant variables is to use
    _____
    letters.
    Hint

    This convention makes constants visually distinct from ordinary variables.

    Answer

    uppercase

    Explanation

    The tutorial notes that developers often capitalize constant names, though it is not required.

  45. 45
    The C function commonly used to print text or values onto the screen is
    _____
    Hint

    Its name is short for formatted printing.

    Answer

    printf

    Explanation

    printf displays text and formatted values on the screen.

  46. 46
    In printf, a
    _____
    tells the function to insert a value of a particular data type into the output.
    Hint

    Examples include %d and %s.

    Answer

    format specifier

    Explanation

    A format specifier marks a placeholder and identifies the type of value to print.

  47. 47
    The format specifier used by printf to display an integer is
    _____
    Hint

    The letter in the specifier represents a decimal integer.

    Answer

    %d

    Explanation

    %d is used to print an integer value.

  48. 48
    The printf format specifier used to insert a string is
    _____
    Hint

    It is used for a sequence of characters.

    Answer

    %s

    Explanation

    %s is the placeholder for a string of characters.

  49. 49
    The printf format specifier used to display a decimal value such as a double is
    _____
    Hint

    The tutorial uses this for floating-point output.

    Answer

    %f

    Explanation

    %f displays a floating-point or decimal value in printf.

  50. 50
    The printf format specifier used to display one character is
    _____
    Hint

    It is used with a char value.

    Answer

    %c

    Explanation

    %c is the format specifier for a single character.

  51. 51
    When multiple format specifiers appear in a printf string, the supplied values must be listed in the
    _____
    order.
    Hint

    The first supplied value fills the first placeholder.

    Answer

    same

    Explanation

    Each value corresponds to a format specifier in the order in which the specifiers appear.

  52. 52
    To print a quotation mark inside a C string without ending the string, place a
    _____
    before it.
    Hint

    This character is used to escape special characters.

    Answer

    backslash

    Explanation

    A backslash escapes the quotation mark so it is printed as part of the text.

  53. 53
    The C operator used for addition is
    _____
    Hint

    It is the familiar arithmetic symbol for summing values.

    Answer

    Explanation

    C uses + for addition.

  54. 54
    The C operator used for multiplication is
    _____
    Hint

    It is the asterisk symbol.

    Answer

    Explanation

    C uses * for multiplication.

  55. 55
    The C operator used for division is
    _____
    Hint

    It is the forward slash symbol.

    Answer

    /

    Explanation

    C uses / for division.

  56. 56
    When two integers are divided in C, the result is an
    _____
    and the fractional part is discarded.
    Hint

    For example, integer division of 5 by 4 produces 1 rather than 1.25.

    Answer

    integer

    Explanation

    Operations between two integers return an integer, so a fractional remainder is not retained.

  57. 57
    When an integer and a floating-point number are used together in arithmetic, the result is a
    _____
    number.
    Hint

    The result can retain a decimal part.

    Answer

    floating-point

    Explanation

    An operation involving an integer and a floating-point value returns a floating-point result.

  58. 58
    The math function that raises its first argument to the power of its second argument is
    _____
    Hint

    For example, it can compute 2 raised to the third power.

    Answer

    pow

    Explanation

    pow takes a base and an exponent and returns the base raised to that power.

  59. 59
    The math function used to calculate the square root of a value is
    _____
    Hint

    Its name abbreviates square root.

    Answer

    sqrt

    Explanation

    sqrt returns the square root of its argument.

  60. 60
    The ceil function rounds a decimal value up to the
    _____
    whole number.
    Hint

    For example, 36.3 becomes 37.

    Answer

    next highest

    Explanation

    ceil returns the next highest integer value for a decimal input.

  61. 61
    The floor function rounds a decimal value
    _____
    to a whole number.
    Hint

    For example, 36.6 becomes 36.

    Answer

    down

    Explanation

    floor rounds a decimal value down to the lower integer.

  62. 62
    A C comment is code text that is
    _____
    when the program runs.
    Hint

    Comments can contain notes without affecting execution.

    Answer

    ignored

    Explanation

    The compiler does not execute the text contained in a comment.

  63. 63
    The multiline comment form in C begins with /* and ends with
    _____
    Hint

    The closing marker reverses the order of the symbols in the opening marker.

    Answer

    */

    Explanation

    A multiline comment is enclosed between /* and */.

  64. 64
    Putting code inside comment markers to prevent it from executing is called
    _____
    out the code.
    Hint

    This lets a programmer disable code without deleting it.

    Answer

    commenting

    Explanation

    Commenting out code temporarily disables it while preserving the text in the file.

  65. 65
    A scanf call generally performs the opposite task from printf: it reads
    _____
    from the user.
    Hint

    The user supplies information that the program can store and use.

    Answer

    input

    Explanation

    scanf accepts information entered by the user, while printf displays information.

  66. 66
    A variable that will receive user input can be declared without an initial
    _____
    Hint

    The program waits for the user to supply it later.

    Answer

    value

    Explanation

    A variable can be declared first and given a value when the input is read.

  67. 67
    When scanf stores a numeric or character input in a variable, the variable is preceded by an
    _____
    Hint

    It is the symbol &, used to supply the variable's address.

    Answer

    ampersand

    Explanation

    For numeric and single-character input, scanf needs the address of the variable, written with &.

  68. 68
    In scanf, the format specifier for reading a double is
    _____
    Hint

    It differs from the specifier used to print a double.

    Answer

    %lf

    Explanation

    scanf uses %lf to read a double, whereas printf uses %f to display one.

  69. 69
    When scanf reads a character, putting a space before %c helps it skip
    _____
    characters left in the input.
    Hint

    Spaces and newline characters belong to this category.

    Answer

    whitespace

    Explanation

    The leading space in the format string causes scanf to skip whitespace before reading a character.

  70. 70
    When scanf reads a string using %s, it stops at the first
    _____
    Hint

    This is why a full name with two words may be truncated.

    Answer

    space

    Explanation

    scanf with %s reads characters only up to the first whitespace, such as a space.

  71. 71
    For a string supplied by a user, the array size should be specified so C can allocate enough
    _____
    Hint

    The program needs space to hold the expected number of characters.

    Answer

    memory

    Explanation

    The array capacity tells C how much memory to allocate for the string.

  72. 72
    The function recommended for reading a whole line of text, including spaces, is
    _____
    Hint

    Unlike scanf with %s, it can capture multiple words.

    Answer

    fgets

    Explanation

    fgets reads a line of text and can capture spaces within it.

  73. 73
    The first argument to fgets identifies the
    _____
    where the input line should be stored.
    Hint

    It is the destination character array.

    Answer

    string variable

    Explanation

    fgets needs the name of the destination buffer as its first argument.

  74. 74
    The size argument to fgets limits how many characters the program accepts and helps prevent a buffer
    _____
    Hint

    This can happen if the input is larger than the available storage.

    Answer

    overflow

    Explanation

    Limiting the number of characters helps keep input from exceeding the string buffer's capacity.

  75. 75
    The stdin argument to fgets identifies
    _____
    as the source of the input.
    Hint

    It is typically the console used to enter information.

    Answer

    standard input

    Explanation

    stdin means standard input, the input stream used by the console.

  76. 76
    When a user presses Enter after using fgets, the resulting
    _____
    character may be stored in the string.
    Hint

    It represents the line break at the end of the entered text.

    Answer

    newline

    Explanation

    fgets can include the newline created when the user presses Enter.

  77. 77
    An array is a data structure that can store multiple
    _____
    values in one organized container.
    Hint

    It is useful when a program has a related collection of values.

    Answer

    data

    Explanation

    Arrays organize multiple values together, unlike a single variable that stores one value.

  78. 78
    In a basic C array, all elements must have the same
    _____
    Hint

    For example, an integer array holds integers.

    Answer

    data type

    Explanation

    The content contrasts arrays, whose elements share a type, with structs that can contain different types.

  79. 79
    The index of the first element in a C array is
    _____
    Hint

    The first position is not numbered 1 in C.

    Answer

    0

    Explanation

    C array indexing begins at zero, so the first element is at index 0.

  80. 80
    A particular array element is accessed by placing its
    _____
    inside square brackets after the array name.
    Hint

    It identifies the element's position.

    Answer

    index

    Explanation

    The array name and an index in square brackets select a specific element.

  81. 81
    To change one element in an array, assign a new value to the array name at the desired
    _____
    Hint

    The element is selected in the same way it is accessed.

    Answer

    index

    Explanation

    An individual element can be modified by assigning a value to its indexed position.

  82. 82
    When an array is declared before its values are known, its capacity must be specified so C can allocate enough
    _____
    Hint

    C needs to know how many elements the array can hold.

    Answer

    memory

    Explanation

    An array declared without initial values needs a defined capacity for memory allocation.

  83. 83
    A C string is essentially an
    _____
    of characters.
    Hint

    Its characters occupy indexed positions in a sequence.

    Answer

    array

    Explanation

    Strings in C are character arrays, even though they are often referred to simply as strings.

  84. 84
    A two-dimensional array is an array whose elements are themselves
    _____
    Hint

    It can be thought of as rows containing further values.

    Answer

    arrays

    Explanation

    Each element of a two-dimensional array is another array.

  85. 85
    A two-dimensional array's two sets of square brackets identify its two
    _____
    Hint

    They correspond to the outer array and the arrays inside it.

    Answer

    dimensions

    Explanation

    The two bracket pairs represent positions in each of the array's two dimensions.

  86. 86
    A loop inside another loop is called a
    _____
    loop.
    Hint

    The inner loop runs as part of the outer loop's execution.

    Answer

    nested

    Explanation

    Nested loops place one looping structure inside another and are useful for traversing two-dimensional arrays.

  87. 87
    A function is a collection of code designed to perform a specific
    _____
    Hint

    For example, one function might greet a user or calculate a value.

    Answer

    task

    Explanation

    Functions group code that carries out a particular job.

  88. 88
    The main function is the function that is executed when a C program
    _____
    Hint

    It serves as the program's entry point.

    Answer

    starts

    Explanation

    C begins program execution by running main.

  89. 89
    To execute the code inside a function, a program must
    _____
    the function.
    Hint

    This is done using the function's name and parentheses.

    Answer

    call

    Explanation

    Defining a function does not execute it; the function must be called.

  90. 90
    A function declared with the return type void does not return
    _____
    to its caller.
    Hint

    The return type states what the function gives back.

    Answer

    information

    Explanation

    void indicates that the function does not return a value or other information.

  91. 91
    A value passed into a function so it can use that input is called a
    _____
    Hint

    A function can have one or several of these.

    Answer

    parameter

    Explanation

    Parameters let a function receive information from the code that calls it.

  92. 92
    A function's return statement sends a value back to the
    _____
    that called it.
    Hint

    This is the code that invoked the function.

    Answer

    caller

    Explanation

    A return statement provides information from a function to the code that called it.

  93. 93
    A function prototype declares a function's signature before its full definition, allowing the definition to appear below
    _____
    Hint

    It is the function that calls the example function first.

    Answer

    main

    Explanation

    A prototype lets C know a function's return type and parameters before main calls it, even if its body is defined later.

  94. 94
    An if statement executes its enclosed code when its condition evaluates to
    _____
    Hint

    If the condition is false, the body is skipped.

    Answer

    true

    Explanation

    The code inside an if block runs only when its condition is true.

  95. 95
    An else block runs when the condition in the preceding if statement is
    _____
    Hint

    It provides an alternative path for the other outcome.

    Answer

    false

    Explanation

    The else branch executes when the preceding if condition is false.

  96. 96
    An else if lets a program check an additional condition when the preceding condition is
    _____
    Hint

    It tests another possibility in the decision sequence.

    Answer

    false

    Explanation

    An else if provides another condition to test if the earlier condition did not hold.

  97. 97
    The comparison operator == checks whether two values are
    _____
    Hint

    It uses two equals signs rather than one assignment sign.

    Answer

    equal

    Explanation

    The double-equals operator tests equality; a single equals sign assigns a value.

  98. 98
    The comparison operator != checks whether two values are
    _____
    Hint

    It combines an exclamation mark with an equals sign.

    Answer

    not equal

    Explanation

    The != operator is true when the two compared values differ.

  99. 99
    The logical AND operator makes a combined condition true only when
    _____
    conditions are true.
    Hint

    If either condition is false, the combined condition is false.

    Answer

    both

    Explanation

    With AND, every condition in the combined test must be true.

  100. 100
    The logical OR operator makes a combined condition true when at least
    _____
    condition is true.
    Hint

    Unlike AND, it does not require every condition to be true.

    Answer

    one

    Explanation

    With OR, either condition being true is sufficient for the combined condition to be true.

  101. 101
    The exclamation point used to reverse a condition's truth value is called the
    _____
    operator.
    Hint

    It turns true into false and false into true.

    Answer

    negation

    Explanation

    The negation operator reverses the truth value of the condition it precedes.

  102. 102
    A switch statement is useful when comparing one value against many possible
    _____
    Hint

    A grade can be checked against several possible letter choices.

    Answer

    values

    Explanation

    A switch statement compares one expression with multiple possible cases.

  103. 103
    Each possible value checked inside a switch statement is introduced by a
    _____
    label.
    Hint

    For example, one could label the case for grade A.

    Answer

    case

    Explanation

    A case label identifies a value that the switch statement can match.

  104. 104
    The break statement exits a switch case so execution does not continue into the next
    _____
    Hint

    Without it, execution could continue through following labels.

    Answer

    case

    Explanation

    A break stops execution of the switch after the matching case's code runs.

  105. 105
    The default branch of a switch handles a value that matches
    _____
    of the listed cases.
    Hint

    It is the fallback branch, similar to an else block.

    Answer

    none

    Explanation

    The default branch runs when no case matches the switch value.

  106. 106
    A while loop repeats its body as long as its condition remains
    _____
    Hint

    The condition is checked before each iteration.

    Answer

    true

    Explanation

    A while loop continues executing while its condition is true and stops when it becomes false.

  107. 107
    A do-while loop executes its body at least once because it checks the condition
    _____
    the body runs.
    Hint

    This is the key difference from a regular while loop.

    Answer

    after

    Explanation

    A do-while loop runs its body first and checks its condition afterward.

  108. 108
    A for loop commonly combines initialization, a looping condition, and an
    _____
    step in its parentheses.
    Hint

    This step often changes the loop index on each iteration.

    Answer

    increment

    Explanation

    A for loop places initialization, the condition, and an update such as incrementing the index in its header.

  109. 109
    A loop that never reaches a false condition is called an
    _____
    loop.
    Hint

    It continues repeating without stopping on its own.

    Answer

    infinite

    Explanation

    An infinite loop keeps executing because its condition never becomes false.

  110. 110
    A struct groups related fields that may have different
    _____
    Hint

    For example, a student record can include text, an integer, and a decimal value.

    Answer

    data types

    Explanation

    Unlike an array, a struct can contain fields with different data types.

  111. 111
    A struct definition acts as a
    _____
    for creating records with the same named fields.
    Hint

    It describes the fields before individual records are created.

    Answer

    template

    Explanation

    The struct specifies a reusable layout, such as a student's name, major, age, and GPA.

  112. 112
    A field in a struct is accessed by writing the instance name, a
    _____
    and then the field name.
    Hint

    This operator separates a struct variable from one of its members.

    Answer

    dot

    Explanation

    The dot operator accesses a named field, such as a student's age or GPA.

  113. 113
    When a program runs, variables are stored in the computer's
    _____
    Hint

    This is also called random access memory.

    Answer

    RAM

    Explanation

    The content describes RAM as the memory used to store and track program data while programs run.

  114. 114
    The & operator before a variable provides its memory
    _____
    Hint

    It identifies where the variable's value is stored in memory.

    Answer

    address

    Explanation

    The ampersand obtains the memory address of a variable.

  115. 115
    In C, a
    _____
    is a type of data that represents a memory address.
    Hint

    It can refer to where a value is stored in RAM.

    Answer

    pointer

    Explanation

    A pointer is a memory address and can be stored in a pointer variable.

  116. 116
    A pointer variable is declared using the type of the value it points to and an
    _____
    Hint

    This symbol appears in declarations such as int * and char *.

    Answer

    asterisk

    Explanation

    Pointer declarations use an asterisk with the relevant data type, such as int * for a pointer to an integer.

  117. 117
    The * operator used on a pointer to retrieve the value at its address is called
    _____
    the pointer.
    Hint

    It accesses the data stored where the pointer points.

    Answer

    dereferencing

    Explanation

    Dereferencing a pointer obtains the value stored at the memory address it contains.

  118. 118
    The function that opens a file in C is
    _____
    Hint

    It receives a file name and a mode.

    Answer

    fopen

    Explanation

    fopen opens a file and returns a file pointer for working with it.

  119. 119
    The file mode r opens a file for
    _____
    Hint

    It is used when a program needs to retrieve existing file contents.

    Answer

    read

    Explanation

    The r mode is used to read information from a file.

  120. 120
    The file mode w opens a file for writing and can create a new file or
    _____
    an existing file.
    Hint

    Existing contents do not remain when using this mode.

    Answer

    overwrite

    Explanation

    The w mode creates a file if needed and overwrites its contents if it already exists.

  121. 121
    The file mode a writes new information at the
    _____
    of the file.
    Hint

    Existing content is kept rather than replaced.

    Answer

    end

    Explanation

    Append mode adds information after the existing file contents.

  122. 122
    The function used to write formatted text to a file is
    _____
    Hint

    It works similarly to printf but takes a file pointer.

    Answer

    fprintf

    Explanation

    fprintf writes formatted information to the file identified by its file pointer.

  123. 123
    After a program finishes working with an open file, it should call
    _____
    to close it.
    Hint

    This function takes the file pointer as an argument.

    Answer

    fclose

    Explanation

    Closing a file releases it from use and helps ensure changes are finalized.

  124. 124
    If no path is specified when a file is created, it is placed in the same
    _____
    as the C file.
    Hint

    This is the folder containing the program's source file.

    Answer

    directory

    Explanation

    Without an absolute or relative path, the file is created in the source file's directory.

  125. 125
    The fgets function can read a file one
    _____
    at a time into a character buffer.
    Hint

    Each call can retrieve the next portion ending at a line break.

    Answer

    line

    Explanation

    fgets reads a line from a file and stores the characters in the supplied buffer.

  126. 126
    When using fgets to read a file, the arguments include the destination buffer, its maximum size, and the
    _____
    Hint

    It identifies the file being read.

    Answer

    file pointer

    Explanation

    The file-reading call supplies a buffer, its size limit, and the file pointer.

  127. 127
    After fgets reads a line, the file pointer advances so the next call can read the
    _____
    line.
    Hint

    The pointer no longer refers to the beginning of the line just read.

    Answer

    next

    Explanation

    Reading a line advances the file position, allowing subsequent calls to retrieve later lines.

1 of 127
Question 1 of 127

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent