Study guide for the exam

Study guide for the exam#

Only studying with a list of exam questions can become a hit or miss game for preparation. You may get a good grade because the questions you studied for also appeared in the exam (hit). However, you may also get a bad grade even you studied hard, because in the exam different set of questions may have appeared than you prepared for (miss). Then you may push the responsibility on the instructor, because they did not list the relevant questions.

Listing all the questions you may get is difficult, even impossible. Using a list of what you should do in the exam may be better for you to avoid the hit or miss game.

To do well on the exam, you should be able to do the following:

  • translate a process into a flowchart

  • write code based on a flowchart using control flow statements if, if-else, if-else if-else

  • explain how control flow determines the order in which statements are executed

  • declare, initialize variables and constants (immutable values)

  • choose between primitive types based on the nature of the data, e.g., letters vs number or user interaction vs mathematical calculations

    • char, string, int, unsigned .., double, bool

  • explain the significance of the standard library for a programming language

    • differentiate standard libraries for C and Python

  • explain the components of a function signature

  • use scanf and printf to input/output data from/to the console

    • explain format string and format specifier

  • outline the typical layout of a C program

  • use code comments

  • discuss the significance of meaningful variable & function names and how they interplay

  • separate data and program logic for easier code maintainability

  • use an array to represent a homogeneous sequence of data

    • explain the significance of arrays

  • use for loops to repeat an action on array elements

  • use while as control flow element

  • differentiate the control flow elements if-else, for, while on a flowchart

  • use and compare strings

  • define and combine Boolean expressions

  • convert an expression with the ternary conditional operator to an if-else statement

  • differentiate between scanf and fgets

  • generate random numbers

    • use them to select random items

  • convert a decision table to a switch and if-else statement

  • read a single character using getchar()

  • draw hierarchical flowcharts

  • use enum for enumerated types

    • implement a state machine using enum

    • use typedef in enum declaration

  • use raw strings for text spanning many lines

  • process arguments to main

    • design a command-line interface

  • declare and define functions

  • modularize a project using source and header files

    • explain the significance of #pragma once

  • document function prototypes using structured comments

  • differentiate between a static and automatic variable

    • differentiate between static and stack-based arrays (including variable-length array)

  • explain the significance of initializing stack-based arrays

    • initialize a newly declared array

  • use typedef for array declarations

  • differentiate between (pass by) value and reference (address)

  • declare value and function pointers

  • dereference a pointer and get pointer of a value

  • differentiate between datatype array and datatype *pointer.

  • explain how and why pointers are used in function arguments to output data from a function

  • discuss trade-offs of using global variables in an example

  • use array of strings with dynamic content by tracking its size

  • use memset() for initializing arrays

  • break a string into tokens using strtok

  • use struct and union

  • explain the trade-offs of using struct against array

    • explain the significance of data locality

  • implement self-referencing data structures

  • use typedef for struct

  • integrate and use an external library

  • read & write to file.

  • differentiate between a file and stream

  • select correct file-opening mode for the intended operation.

  • use the return values of fgets to loop through a stream

  • explain the responsibilities of the file IO functions fgets & fputs regarding buffer management

    • justify why fgets needs a size compared to fputs

  • differentiate between the three streams stdin, stdout and stderr.

  • explain how linked list stores data

    • contrast this with how an array stores data.

  • evaluate a given problem to determine whether a linked list or an array would be the more appropriate data structure.

  • use a linked list to navigate through its nodes

  • explain how a node is inserted & deleted in a linked list