Podcast Beta
Questions and Answers
What is the correct syntax to redirect the output from the program app into a file named output.txt?
Which command is used to display the contents of a file?
What is the purpose of the touch
command?
Which command is used to run unit tests?
Signup and view all the answers
When should cin
be used?
Signup and view all the answers
What is the purpose of cin.ignore()
?
Signup and view all the answers
What operation is performed by the expression a / b
when a
and b
are integers?
Signup and view all the answers
What is the purpose of mkdir
command?
Signup and view all the answers
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 usingcin
aftergetline
. -
cin.ignore()
should not be used every timecin
is used or every timegetline
is used.
Integer Division
- The correct answer for the integer division question is not provided in the given text.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Introduction to Programming midterm exam for University of California, Merced, Spring 2024 semester.