CSE 1320 Exam 1 Review
16 Questions
0 Views

CSE 1320 Exam 1 Review

Created by
@AccessibleMinneapolis

Questions and Answers

What does the command 'mkdir' do in UNIX?

  • Make a directory (correct)
  • Copy a file
  • Change directory
  • Remove a file
  • Which of the following operators is NOT a logical operator?

  • XOR
  • AND
  • MOD (correct)
  • OR
  • When declaring an array in C, what must all identifiers follow?

  • They must start with a number.
  • They must be of fixed length.
  • They cannot include special characters.
  • They cannot be reserved keywords. (correct)
  • Which formatting specifier would be used to format a floating-point number to two decimal places?

    <p>%.2f</p> Signup and view all the answers

    What is the purpose of the 'continue' statement in control structures?

    <p>To skip to the next iteration of the loop</p> Signup and view all the answers

    In base conversions, which method is commonly used to convert a decimal number to binary?

    <p>Divide by 2 and record the remainders</p> Signup and view all the answers

    What is the primary role of preprocessor directives in C programming?

    <p>To include files and define constants</p> Signup and view all the answers

    What will the 'rm' command do in a UNIX environment?

    <p>Remove a file</p> Signup and view all the answers

    What is the primary purpose of using structures in programming?

    <p>To group related data together</p> Signup and view all the answers

    What is meant by packing in relation to structures?

    <p>Fitting data types into a smaller memory space</p> Signup and view all the answers

    In the context of a 4D vector created using typedef, which of the following best describes the term 'typedef'?

    <p>A way to create an alias for an existing type</p> Signup and view all the answers

    When creating a function that takes a pointer to a structure as an argument, what would you compare?

    <p>The pointer size to the dereferenced struct size</p> Signup and view all the answers

    Which of the following best describes initialization with structure variables?

    <p>Assigning values to structure members upon declaration</p> Signup and view all the answers

    What is the role of the member FILE * in a structure that tracks byte count?

    <p>To keep track of total bytes read from a file</p> Signup and view all the answers

    What must be considered when designing a CSV file to ensure data integrity?

    <p>Presence of all required properties in each line</p> Signup and view all the answers

    What is one key difference between structures and other aggregate types?

    <p>The size of a struct can always be inferred</p> Signup and view all the answers

    Study Notes

    ASCII

    • Recognize the differences between uppercase and lowercase characters in ASCII.

    Base Conversions

    • Understand the process for converting decimal numbers to binary.
    • Grasp the general procedure for conversions between different numerical bases.

    UNIX Commands

    • cd: Change directory.
    • ls: List contents of current directory.
    • mv: Move a file.
    • mkdir: Make a new directory.
    • rm: Remove a file.
    • cp: Copy a file.

    Formatting Standards

    • Indentation should reflect the scope of statements.
    • Consistent spacing is essential for readability.
    • Maintain consistent placement of brackets and braces.

    Identifiers, Keywords & Reserved Words

    • Familiarity with common keywords discussed in class.
    • Understand rules for naming identifiers in programming.

    Formatting Input & Output

    • Apply field width with format specifier, e.g., %10d.
    • Control floating point precision using %.2f.
    • Use escape sequences like \t, \", \', \n, \\.

    Operators

    • Arithmetic Operators: Basic mathematical operations.
    • Equality and Relational Operators: Comparison operations.
    • Compound Assignment: Combine assignment with another operation.
    • Increment and Decrement: Modify values by one.
    • Logical Operators: AND, OR, NOT operations.
    • Bitwise Operators: Operations on binary representations.

    Preprocessor Directives

    • #include: Include files/functions from libraries.
    • #define: Define constants and macros.

    Control Structures

    • Use structures such as if, if-else, switch, while, do...while, and for.
    • Understanding nested loops and control statements like break, continue, and return.

    Function Definitions vs. Declarations

    • Ability to write function declarations from given function signatures.

    Arrays and Strings

    • Know how to declare and initialize one-dimensional and two-dimensional arrays.

    File I/O

    • Open files for various operations: reading, writing, appending, and updating.
    • Close files correctly after operations.
    • Be aware of FILE * pointers and how reading affects the current position in the file.
    • Write code to check for the existence of a file.

    File I/O Problems

    • Create a program to reverse the order of words from a text file into a new file.
    • Write a program to copy text from a file, sorted from most to least words per line.
    • Validate CSV file contents for missing properties.
    • Create and print student grades from a CSV file in a formatted table.

    Structures

    • Declare structures and related variables with correct syntax.
    • Grasp initialization processes for structure variables.
    • Understand packing and padding implications within structures.
    • Note the difference in size inference between structures and other data types.

    Structures Problems

    • Develop a function that accepts a structure pointer and compares the pointer size to the dereferenced structure size.
    • Create a structure for cars that includes the manufacturer.
    • Implement structure holding a FILE * member and track bytes read via fgetc() or fread().

    Typedefs

    • Understand typedef syntax for creating type aliases.
    • Create a typedef for aggregate types, including structures.
    • Develop a four-dimensional vector using typedef.
    • Define structures using typedef for improved clarity.

    Question Types

    • Prepare for definition and evaluation questions regarding basic C programming terms and concepts.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Prepare for your CSE 1320 exam with this review focused on key topics. This quiz covers ASCII character conversions, base conversions, and essential UNIX command-line operations. Test your understanding and readiness for the concepts discussed in class.

    Use Quizgecko on...
    Browser
    Browser