1. Home
  2. Explore
  3. Computer Science
  4. Image Filters in C

Study methods

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

Image Filters in C

  • 76Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Structures and Files
In C, a user-defined data type that groups related fields, such as a student's name and dorm, is called a
.

76 questions

  1. 1
    In C, a user-defined data type that groups related fields, such as a student's name and dorm, is called a
    _____
    .
    Hint

    Think of a custom record that combines multiple pieces of information.

    Answer

    struct

  2. 2
    The C keyword used to define an alias for a structure-based data type is
    _____
    .
    Hint

    It allows a programmer to define a convenient name for a type.

    Answer

    typedef

  3. 3
    In the student structure, the expression students[i].name uses the
    _____
    operator to access a field inside a structure.
    Hint

    This operator is written as a period.

    Answer

    dot

  4. 4
    A header file conventionally used to share structure definitions across multiple C programs typically ends with
    _____
    .
    Hint

    This is the conventional extension for a C header file.

    Answer

    .h

  5. 5
    The C function that opens a file and returns a reference to it is
    _____
    .
    Hint

    Its name combines the words file and open.

    Answer

    fopen

  6. 6
    In the file mode passed to fopen, the letter W indicates that the file is being opened for
    _____
    .
    Hint

    The corresponding mode for retrieving data is represented by R.

    Answer

    write

  7. 7
    The sentinel value used to indicate that fopen failed to produce a valid address is
    _____
    .
    Hint

    It represents the absence of a valid pointer or address.

    Answer

    NULL

  8. 8
    The function that prints formatted output to an opened file rather than to the screen is
    _____
    .
    Hint

    It is the file-oriented counterpart of printf.

    Answer

    fprintf

  9. 9
    Calling
    _____
    after writing to a file completes the file operation and releases the associated resource.
    Hint

    Its name combines file with the opposite of open.

    Answer

    fclose

  10. 10
    A comma-separated values file is commonly abbreviated as
    _____
    .
    Hint

    The abbreviation describes the way values are separated in the file.

    Answer

    CSV

  11. 11
    The region of memory that contains the compiled zeroes and ones of a program is called the
    _____
    segment.
    Hint

    Despite its name, this segment contains machine code rather than ordinary written text.

    Answer

    text

  12. 12
    Global variables that are assigned values when declared are stored in the
    _____
    data region.
    Hint

    The term describes variables that already have assigned starting values.

    Answer

    initialized

  13. 13
    Global variables that have not been assigned values are stored in the
    _____
    data region.
    Hint

    This is the opposite of initialized data.

    Answer

    uninitialized

  14. 14
    Values such as usernames and passwords that should not be stored directly in source code can be placed in
    _____
    variables.
    Hint

    These variables are supplied by the operating system or execution environment.

    Answer

    environment

  15. 15
    The memory region used for function calls, parameters, and local variables is the
    _____
    .
    Hint

    Each function call receives a new frame in this region.

    Answer

    stack

  16. 16
    The memory region used for dynamically allocated, longer-lasting storage is the
    _____
    .
    Hint

    malloc obtains memory from this region.

    Answer

    heap

  17. 17
    Each time a function is called, it receives a portion of stack memory called a stack
    _____
    .
    Hint

    It contains the function's local execution information.

    Answer

    frame

  18. 18
    After a function returns, its stack memory can be reused, so values left there are considered
    _____
    values.
    Hint

    These values were left behind by previous uses of the memory.

    Answer

    garbage

  19. 19
    The function used to request a dynamically allocated block of memory from the heap is
    _____
    .
    Hint

    Its name abbreviates memory allocation.

    Answer

    malloc

  20. 20
    The function used to release memory previously allocated with malloc is
    _____
    .
    Hint

    It returns allocated memory to the operating system for reuse.

    Answer

    free

  21. 21
    A program that allocates memory but does not return it with free can develop a
    _____
    leak.
    Hint

    The missing resource is allocated storage.

    Answer

    memory

  22. 22
    The function that allocates memory like malloc while also clearing the allocated bytes to zero is
    _____
    .
    Hint

    The C in its name refers to clearing the memory.

    Answer

    calloc

  23. 23
    The function that can resize an existing allocated memory block is
    _____
    .
    Hint

    Its name combines allocation with the idea of doing it again.

    Answer

    realloc

  24. 24
    A variable declared as int *x stores the
    _____
    of an integer rather than the integer itself.
    Hint

    It identifies where the integer is located in memory.

    Answer

    address

  25. 25
    The unary * operator applied to a pointer means to
    _____
    the address stored in that pointer.
    Hint

    It follows the pointer to access the value at its destination.

    Answer

    dereference

  26. 26
    The & operator is used to obtain the
    _____
    of a variable.
    Hint

    It produces the location that can be stored in a pointer.

    Answer

    address

  27. 27
    Passing the addresses of x and y to swap allows the function to modify the original variables through
    _____
    .
    Hint

    The function receives locations rather than copies of the values.

    Answer

    pointers

  28. 28
    Declaring a pointer variable alone does not allocate the pointed-to object; it initially contains a
    _____
    value.
    Hint

    The pointer has storage for an address, but no valid destination has been assigned.

    Answer

    garbage

  29. 29
    Writing through an uninitialized pointer can cause a
    _____
    fault because the program accesses memory it should not touch.
    Hint

    This fault indicates an invalid memory access.

    Answer

    segmentation

  30. 30
    Assigning y = x when both are pointers makes y point to the
    _____
    memory block as x.
    Hint

    The address is copied; a new block is not allocated.

    Answer

    same

  31. 31
    Returning the address of a local array from a function is unsafe because the array's stack memory becomes
    _____
    after the function returns.
    Hint

    The memory may be reused by later function calls.

    Answer

    garbage

  32. 32
    A buffer is a chunk of memory used to store data, such as the characters in a
    _____
    .
    Hint

    In C, this is an array of characters ending with a null terminator.

    Answer

    string

  33. 33
    Copying more data into a buffer than it can hold creates a
    _____
    overflow.
    Hint

    The problem is that the data exceeds the buffer's boundary.

    Answer

    buffer

  34. 34
    A program that writes to index 10 of an array allocated for 10 integers performs an invalid write because valid indexes end at
    _____
    .
    Hint

    C arrays use zero-based indexing.

    Answer

    9

  35. 35
    Overwriting a function's saved return address with attacker-controlled data is the basis of a buffer overflow
    _____
    .
    Hint

    It allows an attacker to redirect program execution.

    Answer

    exploit

  36. 36
    The tool used to detect memory leaks and other memory-related errors in C programs is
    _____
    .
    Hint

    It reports invalid reads, invalid writes, and lost allocated blocks.

    Answer

    Valgrind

  37. 37
    In Valgrind's message invalid right of size four, the size refers to the number of bytes in a typical C
    _____
    .
    Hint

    The lecture states that this type commonly occupies four bytes.

    Answer

    int

  38. 38
    The practice of explaining code aloud to an inanimate object to uncover bugs is called
    _____
    duck debugging.
    Hint

    The object is commonly a small bath toy.

    Answer

    rubber

  39. 39
    An array stores elements in a
    _____
    chunk of memory.
    Hint

    The elements are placed directly next to one another.

    Answer

    contiguous

  40. 40
    Growing an array by allocating a larger one and copying all old elements takes linear time, or big O of
    _____
    .
    Hint

    The amount of work grows with the number of elements copied.

    Answer

    n

  41. 41
    A linked list stores each element together with a pointer to the next
    _____
    .
    Hint

    Each individual element in the list is given this structural name.

    Answer

    node

  42. 42
    The pointer in a linked-list node that identifies the following node is conventionally named
    _____
    .
    Hint

    It indicates what comes after the current node.

    Answer

    next

  43. 43
    A linked list is remembered by a pointer to its first node, commonly called
    _____
    .
    Hint

    This name identifies the beginning of the list.

    Answer

    first

  44. 44
    The next pointer of the final node in a linked list should contain
    _____
    .
    Hint

    It indicates that there is no following node.

    Answer

    NULL

  45. 45
    A major advantage of linked lists over fixed-size arrays is that linked lists can grow and shrink
    _____
    .
    Hint

    Their size can change while the program runs.

    Answer

    dynamically

  46. 46
    If sorted order is not required, inserting a new node at the beginning of a linked list can take
    _____
    time.
    Hint

    Only a fixed number of pointer updates are needed.

    Answer

    constant

  47. 47
    Searching a linked list for a sorted insertion point generally takes linear time, or big O of
    _____
    .
    Hint

    The search may need to visit many nodes one by one.

    Answer

    n

  48. 48
    When a pointer refers to a structure, the C operator used to follow the pointer and access a structure field is the
    _____
    operator.
    Hint

    It is written using a hyphen followed by a greater-than sign.

    Answer

    arrow

  49. 49
    When freeing a linked list, a program should save the current node's next pointer before calling
    _____
    on the current node.
    Hint

    The operation releases dynamically allocated memory.

    Answer

    free

  50. 50
    A stack follows the LIFO rule, meaning
    _____
    in, first out.
    Hint

    A newly placed tray is the first one removed.

    Answer

    last

  51. 51
    The operation that adds an item to a stack is conventionally called
    _____
    .
    Hint

    It is like placing another tray on top of a stack.

    Answer

    push

  52. 52
    The operation that removes an item from a stack is conventionally called
    _____
    .
    Hint

    It is like taking the top tray away.

    Answer

    pop

  53. 53
    A queue follows the FIFO rule, meaning
    _____
    in, first out.
    Hint

    The earliest person in line is served first.

    Answer

    first

  54. 54
    The operation that adds an item to a queue is conventionally called
    _____
    .
    Hint

    It places an item at the back of the line.

    Answer

    enqueue

  55. 55
    The operation that removes an item from a queue is conventionally called
    _____
    .
    Hint

    It removes the item at the front of the line.

    Answer

    dequeue

  56. 56
    An array-based stack must track its current
    _____
    so it does not exceed its capacity.
    Hint

    This records how many items are currently stored.

    Answer

    size

  57. 57
    A queue implementation can avoid shifting every remaining element by tracking which item is in
    _____
    .
    Hint

    This identifies the person or item at the beginning of the line.

    Answer

    front

  58. 58
    An application programming interface is abbreviated as
    _____
    .
    Hint

    It describes the operations exposed by an implementation.

    Answer

    API

  59. 59
    In a tree, the topmost node from which the structure is accessed is called the
    _____
    .
    Hint

    It is analogous to the starting point of a family tree.

    Answer

    root

  60. 60
    Nodes at the bottom of a tree that have no children are called
    _____
    .
    Hint

    The term compares the structure to a plant.

    Answer

    leaves

  61. 61
    A tree in which every node has at most two children is called a
    _____
    tree.
    Hint

    The prefix refers to two possible branches.

    Answer

    binary

  62. 62
    A binary tree in which every left descendant is smaller and every right descendant is larger is a binary
    _____
    tree.
    Hint

    The ordering makes efficient lookup possible.

    Answer

    search

  63. 63
    Searching a reasonably balanced binary search tree takes logarithmic time, or big O of
    _____
    .
    Hint

    Each comparison can eliminate roughly half of the remaining tree.

    Answer

    log n

  64. 64
    In a binary search tree, a node's two child pointers are conventionally named
    _____
    and right.
    Hint

    This pointer identifies the smaller subtree.

    Answer

    left

  65. 65
    The left and right pointers of a leaf node contain
    _____
    because the leaf has no children.
    Hint

    The pointers do not refer to any further nodes.

    Answer

    NULL

  66. 66
    A function that calls itself to search smaller subtrees is using
    _____
    .
    Hint

    The function solves a smaller version of the same problem by calling itself.

    Answer

    recursion

  67. 67
    A function that assigns an input to a bucket or index is called a
    _____
    function.
    Hint

    It transforms an item into a location used for storage or lookup.

    Answer

    hash

  68. 68
    When two different inputs produce the same hash value, the situation is called a hash
    _____
    .
    Hint

    Two items have arrived at the same intended location.

    Answer

    collision

  69. 69
    The technique of checking consecutive positions until an empty one is found is called linear
    _____
    .
    Hint

    The algorithm searches through the table one position at a time.

    Answer

    probing

  70. 70
    A hash table that stores a linked list at each bucket uses separate
    _____
    to resolve collisions.
    Hint

    Each bucket becomes the beginning of a chain of entries.

    Answer

    chaining

  71. 71
    A well-designed hash function should distribute entries approximately
    _____
    across the available buckets.
    Hint

    It should avoid concentrating most entries in only a few chains.

    Answer

    uniformly

  72. 72
    A trie stores words by following pointers selected according to each word's individual
    _____
    .
    Hint

    The path for Maxwell begins with M, then A, then the remaining characters.

    Answer

    letter

  73. 73
    In a trie, a special marker at the end of a path indicates that a complete
    _____
    ends there.
    Hint

    The path may also be a prefix of a longer word, so the marker identifies completion.

    Answer

    word

  74. 74
    Looking up a name in a trie takes time proportional to the number of
    _____
    in that name.
    Hint

    The lookup follows one pointer for each character.

    Answer

    letters

  75. 75
    Assuming names have bounded length, a trie provides effectively
    _____
    -time lookup.
    Hint

    Adding more names does not increase the number of steps for a particular bounded-length name.

    Answer

    constant

  76. 76
    The main trade-off of a trie is very fast lookup in exchange for using more
    _____
    .
    Hint

    Each node contains an array of pointers.

    Answer

    memory

1 of 76
Question 1 of 76

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent