c++作业 | quiz代做 | java作业 | 作业shell – Quiz

Quiz

c++作业 | quiz代做 | java作业 | 作业shell – 本题是一个利用java进行练习的代做, 对java的流程进行训练解析, 是有一定代表意义的c++/java/shell等代写方向, 这个项目是quiz代写的代写题目

quiz代写 代写quiz


STUDENT NUMBER:
  • Write your student number clearly and legibly in the boxes above and at the top of every page that contains an answer. Do not write your name on the quiz.
  • The instructor and TAs will not answer questions during the quiz. If you think a question in the quiz is ambiguous or contains an error, make an assumption about what is meant and write a note stating your assumption.
  • Leave your student ID card out to be checked.
  • Stay quiet in the classroom. Keep your eyes on your paper, the instructor, the TAs, or the blackboard.
  • The relevant summary sheets are included at the end of this quiz for your reference. We will not mark answers written on those summary sheets. You may tear them out of the quiz if you wish and leave them on your desk when you leave.
  • There is a blank page provided in the quiz for rough work (right before the summary sheets).
  • If you answer a question on a different page, write us a note telling us where to find your answer.
  • For full marks, your answers must be legible and use correct syntax.
  • Comments are not required since you’re writing under time pressure.
  • We will only mark one answer for each question. If you write a rough answer and then a final answer, cross out the rough work or circle the final answer to tell us which one you want us to mark.
  • You may write your answers in pen or pencil but do not write in red or pink or purple.
  • If you’re done more than 10 minutes early, take your paper to the front desk and leave quietly. We will ask students who finish during the last 10 minutes to sit quietly in their seats.
  • IF YOU LEAVE EARLY, PLEASE BE QUIET AND RESPECT THOSE WHO ARE STILL WRITING! Walk outside the building before you discuss the quiz and or make noise.
The following area is for marking purposes only:

1. ___________ / 1

2. ___________ / 2

3. ___________ / 5

4. ___________ / 5

5. ___________ / 5

Total: ________ / 18

Question 1 (1 point):

In class there was an explanation of the history of C, c++ and java and the relationships between these languages. Please circle the ONE statement below which most accurately describes the order in which these three languages were created:

  • Java was created first, then C, then C++
  • C was created first, then C++, then Java
  • Java was created first, then C++, then C
  • C++ was created first, then Java, then C
  • C was created first, then Java, then C++
  • C++ was created first, then C, then Java

Question 2 (2 points):

Suppose there is a command called mystery that takes two arguments and prints several lines of text output onto the screen. You’d like to see the output of the command

mystery cat goldfish

with the output lines in alphabetical order, not in the order they’d be printed by mystery. Remember that there is a sort command which reads lines from its standard input and prints them on the standard output in alphabetical order. You may not create any temporary files. Write a single line that you could type to accomplish this:

Question 3 (5 points):

Write a shell script called oneString that takes 2 or more arguments and determines whether all of the argument values are the same. If the script is called with less than two arguments, it should print an error message. Otherwise, it should print an appropriate message telling the user whether or not the arguments are equal.

As an example the following is a transcript of several uses of my solution: $ oneString less than two arguments $ oneString apple less than two arguments $ oneString apple banana arguments are not equal $ oneString grape grape all arguments are equal $ oneString rock rock paper rock rock arguments are not equal $ oneString scissors scissors scissors scissors all arguments are equal

When marking this question we’re not going to be fussy about whether the error messages go to the standard output stream or the standard error stream, or what the exit status of the script is. But for full marks you need to make sure that for any set of parameters the script will script will print exactly one line of output and not multiple lines.

Question 4 (5 points):

Suppose there is a program on your computer called roll that simulates the roll of one 6-sided die. It’s in a standard directory so you don’t have to type a directory name when you call the program. The program does not expect any arguments. Each time it is called it prints a random number between 1 and 6.

Write a script called dice that will simulate the roll of multiple dice. It should take one parameter, the number of dice, and print the sum of calling roll that many times. This is NOT the same as calling roll once and multiplying the result by the number of dice, since roll may return a different number each time it is called.

No error checking needed; you may assume that the number of dice is equal to or greater than 1.

Question 5 (5 points):

Fill in the output of the cat commands below in the boxes provided. If you think one of them would cause an error, write “error” in the box but continue on to the remaining commands. (Note: when you redirect the standard output using “>| somefile” or “>> somefile” it changes the contents of somefile. It does not create a new file. )

echo “AAA” >| fileA ln fileA fileB ln -s fileA fileC echo “BBB” >> fileB cat fileC

rm fileA echo “CCC” >| fileD echo “DDD” >| fileA echo “EEE” >> fileB cat fileA

cat fileB

cat fileC

cat fileD

This page is left blank for rough work. If you write an answer here and want us to mark it please indicate this on the page with the question.