CSE 22 Midterm Exam Spring 2024

SofterBiedermeier avatar
SofterBiedermeier
·
·
Download

Start Quiz

Study Flashcards

8 Questions

What is the correct syntax to redirect the output from the program app into a file named output.txt?

app > output.txt

Which command is used to display the contents of a file?

cat content.txt

What is the purpose of the touch command?

To create a new file

Which command is used to run unit tests?

make test

When should cin be used?

A & B

What is the purpose of cin.ignore()?

To clear the input buffer when using cin after getline

What operation is performed by the expression a / b when a and b are integers?

Integer division

What is the purpose of mkdir command?

To create a new directory

Study Notes

University of California, Merced - CSE 22: Introduction to Programming Midterm Examination

  • The exam consists of 7 multiple-choice questions.
  • The exam is a closed book exam, and no notes or electronic devices are allowed.
  • The exam duration is 1 hour and 15 minutes.
  • Students must write their first and last name and UC Merced email on the Scantron and Exam Booklet.

Redirecting Output

  • The command app > output.txt redirects the output from the program app into a file named output.txt.

Printing File Contents

  • The command cat content.txt prints the contents of the file content.txt to the console.

Creating a File

  • The command touch content.txt creates the file content.txt.

Running Unit Tests

  • The command make test runs the unit tests.

Input Streams

  • cin should be used to ask the user to input a number or a single word string.
  • cin should not be used to ask the user to input a multi-word string.

Clearing Input Buffer

  • cin.ignore() should be used to clear the input buffer when using cin after getline.
  • cin.ignore() should not be used every time cin is used or every time getline is used.

Integer Division

  • The correct answer for the integer division question is not provided in the given text.

Introduction to Programming midterm exam for University of California, Merced, Spring 2024 semester.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Use Quizgecko on...
Browser
Browser