辅导案例-CSE278

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 1/18
Midterm Exam (Remotely Proctored)
截止时间 10月5日 21:05 得分 80 问题 30
可用 10月5日 20:00 至 10月5日 21:10 大约 1 个小时 时间限制 60 分钟
说明
The midterm will use Proctorio. You will have 60 minutes to complete, but may not need the entire time.
Even if your final answers are incorrect, you will get partial credit if intermediate steps are clearly
shown to highlight thought process.
You have 60 minutes (1 hour) to complete the exam.
The exam is 80 points with 8 points of potential extra-credit (i.e., there is 10% extra-credit available)
You may use your own handwritten notes for the exam only. You are NOT allowed to use any other
resources; this includes but is not limited to: Internet (e.g., searching external website), cellphone, IDE,
virtual machine, etc. Using any other resource but your handwritten notes will be considered Academic
Dishonesty and will be reported.
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 2/18
此测验锁定于 10月5日 21:10。
尝试历史记录
尝试 时间 分数
最新 尝试 1 59 分钟 56,满分 80 分
此测验的分数: 56,满分 80 分
提交时间 10月5日 20:59
此尝试进行了 59 分钟。
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 3/18
0 / 2 分问题 1
The primary motivation for systems programming is to:
Develop effective graphical user interfaces
Develop core programs such as operating systems, web-servers, etc. 正确回答
Redesign programs to make them better
Facilitate effective conversation between computers and scientists 您已回答
2 / 2 分问题 2
答案 1:
答案 2:
答案 3:
Provide the line of code to create an alias for a vector of integers named
IntList:
using IntList = std::vector ;
using正确!
IntList正确!
std::vector正确!
vector 正确回答
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 4/18
0 / 2 分问题 3
What is a key difference with arrays in C++ as compared to Java?
They can grow and shrink 您已回答
They cannot be empty
They have a fixed size
They have no length method 正确回答
2 / 2 分问题 4
Which of the following the correct way to compile C++ code?
g++ HelloWorld -o main.cpp
g++ HelloWorld main.cpp -o
g++ main.cpp HelloWorld -o
g++ main.cpp -o HelloWorld 正确!
0 / 2 分问题 5
What data type would be best to represent a person's age?
char 正确回答
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 5/18
float
int 您已回答
short
0 / 2 分问题 6
Which of the 5 layers of the TCP/IP model allows for the creation of local
area networks (LANs)?
Physical Layer
Network Layer 您已回答
Link Layer 正确回答
Local Layer
2 / 2 分问题 7
What is the default port over which SMTP communicates?
80
53
22
25 正确!
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 6/18
0 / 2 分问题 8
What member scoping allows for access by derived classes:
package
protected 正确回答
private 您已回答
subclass
2 / 2 分问题 9
Given a C++ program to count words, the compiler requires that the
source file name of the program to be:
The source file name does not matter to the compiler 正确!
count_words.cpp (must be all lower case)
CountWords.cpp (must be mixed case)
Count_Words.cpp (must have underscore between words)
0 / 2 分问题 10
In the code fragment below, s2 is:

2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 7/18
std::string s1 = "***";
std::string s2 = s1;
A reference to object s1
A separate string object initialized to "***" 正确回答
An alias to s1
A reference to string "***" 您已回答
2 / 2 分问题 11
When packets are routed through the Internet between a pair of
computers,
The route taken by each packet can be different 正确!
The route taken is fixed by the operating system
The route for all packets is fixed after TCP handshake
Routes taken is fixed by MAC address
0 / 2 分问题 12
The IPv4 address of the loopback (lo) device associated with localhost is:
127.0.0.8您已回答
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 8/18
正确答案 127.0.0.1
2 / 2 分问题 13
A command that can be used to send and receive characters to a
program running on test.miamioh.edu at port 23:

telnet test.miamioh.edu
telnet ceclnx01.cec.miamioh.edu 23
ssh test.miamioh.edu 23
telnet test.miamioh.edu 23 正确!
0 / 2 分问题 14
A TCP/IP network endpoint consists of:
Host name and its IP address 您已回答
It depends on the program and operating system
Host name and port number 正确回答
MAC address and port number
2 / 2 分问题 15
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 9/18
The result of the expression 1 / 3 is:
0 正确!
0.3333 (float)
0.33333333 (double)
Error
2 / 2 分问题 16
答案 1:
答案 2:
<< is the stream insertion operator
>> is the stream extraction operator
<<正确!
>>正确!
0 / 2 分问题 17
In the code snippet below, the last line of code:
using IntVec = std::vector;
IntVec v1 = {2,2,2};
IntVec v2 = v1;
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 10/18
An error as they are vectors
Makes v2 initialized to values of v1 正确回答
Makes v2 an empty vector
Makes v2 a reference to v1 您已回答
1 / 3 分问题 18
您的答案:
Briefly (2 to 3 sentences) describe the following layer of the 5 layer TCP
model: Network Layer. The answer should include whether
hardware/software and what type of network is made possible by this
layer.
The Network layer is the third layer in 5 layers. It use the ICMP the
Internet Control Message Protocal. The datagrams in this layer will
exchange data with variable size pockets.
And ICMP will provide managements, ICMo used by networks admins.
The network layer spans both hardware and software. It enables
LANS to communicate as part of a WAN
3 / 3 分问题 19
Briefly (1 or 2 sentences) describe a scenario when unsigned numbers
are a better/correct engineering/design solution rather than signed
numbers
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 11/18
您的答案:
The unsigned numbers are always positive. So it is very useful when you
use it to show someone's age, weight. Because all of these variables can
not be negative.
2 / 2 分问题 20
您的答案:
What is the difference between a vector and an unordered_map? It
should be clear how both of them work.
The vector only have one type of data inside<>; When you use
unordered_map, it can have two, you can have one key help you make
your program easier. Like you can store the variable by the first key
variable string, like 'lab", all the lab data will store in same place, and you
change you key to exam, all the exam data will store in exam place. The
vector like array in java, it can push_back data in vector.
4 / 4 分问题 21
Tabulate 2 significant differences to contrast UDP vs. TCP (your answer
should essentially fill in the table below - 2 responses each)
------------------------
| UDP | TCP |
------------------------
| ? | ? |
------------------------
| ? | ? |
------------------------
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 12/18
您的答案:
UDP send/ recieve datagrams build top of IP. it is connectionless, and no
flow control, and does not guaratee reliability. it used for gaming, multi-
media.

TCP is connection, reliability, widely-use, have flow control, congestion
control.
1.5 / 3 分问题 22
您的答案:
Briefly (1-2 sentences) explain what is polymorphism. Provide an
example.
Polymorphism, is 4 key principles of object-oriented programming, when
the class have inheritance, it can use the polymorphism. The interface is a
example of polymorphism.
Inheritance is also one of the 4 key principles of OOP. How does
polymorphism differ?
3 / 3 分问题 23
您的答案:
When is it safe for a method to return a reference?
std::string&method(std::string& str){
str[0] = '*';
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 13/18
return str;
}
OK -- I'll give credit for this. The idea was to describe the situation,
not provide code.
0 / 2 分问题 24
Assuming that you are in the directory /home/user/cse278/hw1/ and have
a file hw1.cpp, how can you copy that file to a folder "MyHomework" in
your home directory by using only relative paths in the terminal?
cp hw1.cpp ~/MyHomework您已回答
正确答案 cp hw1.cpp ../../MyHomework/
cp hw1.cpp ../../MyHomework
cp hw1.cpp ../../MyHomework/hw1.cpp
2 / 2 分问题 25
Assuming that you are in the directory /home/user/cse278/hw1/, write the
shortest possible shell command to change the present working directory
to the user's home directory.
cd正确!
正确答案 cd
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 14/18
3.5 / 4 分问题 26
您的答案:
Consider the program below is successfully compiled to an executable
named midterm, illustrate how you would run the program from a terminal
(along with any inputs you may type - it may be helpful to denote
command-line vs standard input) to make the program print "Pass". Briefly
describe the reason for your answer.
#include
int main(int argc, char*argv[]) {
auto i=0;
if (argv[1][2]=='t') {
std::cin >> i >> i;
}
if (i==7) {
std::cout << "Pass!\n";
}
return 0;
}

./midterm.cpp ttt
-7
-7
If you had left off the minus signs on the sevens, this would be
correct.
6 / 6 分问题 27
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 15/18
您的答案:
Briefly describe the TCP handshake. Consider who initiates it and what
message(s) are sent.
3 way tcp handshake;
1 SYN client send SYN to server
2 SYN-ACK in response, the server replies with SYN-ACK
3 ACK- Finally the client sends an ask back to server
2 / 4 分问题 28
您的答案:
Write a simple program that checks the number of program arguments to
ensure there are at least 3 arguments and that the first user argument is
"-o"
int main(int argc, char** argv) {
// Your code
}
if(argc !=3){
std::cerr << "Incorrect number of command line arguments\n";
}
if(argc[0] !="-0"){
std::cerr <<"wrong";
}

2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 16/18
Should check if argc >= 4. Need to convert argv[1] or "-o" to
std::string to do comparison. And you'd have to compare to "-o",
not "-O"
8 / 10 分问题 29
您的答案:
An employee data file (1 line per employee, just the data items without
column titles) contains columns separated by commas as shown below.
Complete the following method to return average salary stored in the
employee data file at the given path. Assume you already have all the
necessary includes and you don't have to handle exceptions/errors.
double avgSalary(const std::string& path) {
// Your Code
}

File example:
L.name,F.name,Salary,Dept
Doe,John,100.3,MBI
Gates,Bill,3000.3,CSE
Mayer,Marissa,4000.0,CSE
Hawking,Steven,35000.0,PHY

std::ifstream in("file.txt")
std::sting line;
int num = 0;
while(getLine(in,line)){
vector strVec;
boost::split(strVec,line,boost::is_any_of(",");
2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 17/18
sum+=strVec[2];
num++;
}
return sum/num;
See grading rubric for details
4 / 0 分问题 30
您的答案:
EXTRA CREDIT [8 points]: Complete the following method that returns a
vector with only odd values in the src vector. If the src vector has values
{2, -4, 7, 9, 8, 3} this method should return a vector with values {7, 9, 3}.
Make sure the solution is generic and does not only solve the example
case.
using IntVec = std::vector;
IntVec odds(const IntVec& src) {
// Your Code
}
inrVec = ret;
for(int i :nums){
if(i%2 == 1){
ret.push_back(i);
}
return ret;

2020/11/10 Midterm Exam (Remotely Proctored): CSE278 E,F
https://miamioh.instructure.com/courses/129645/quizzes/329044 18/18
See rubric for details
测验分数: 56,满分 80 分

欢迎咨询51作业君
51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468