EECS 281 - LAB 1 QUIZ QUESTIONS AND
ANSWERS
What is the correct login string for CAEN?
xz xz xz xz xz xz xz
NOTE:In this class, when we want to indicate that you should use a variable but we are writi
xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz
ngtext in a document, we will surround the variable with < and >. For example, for optionA in
xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz x
the following answers, Dr. Paoletti's personal login string would .u
z xz xz xz xz xz xz xz xz xz
mich.edu, because he would replace <uniqname> with his uniqname(paoletti).
xz xz xz xz xz xz xz xz
A. ssh <uniqname>@login.engin.umich.edu
xz xz
B. ssh <uniqname>@engin.umich.edu
xz xz
C. ssh <uniqname>@caen.umich.edu
xz xz
D. ssh <uniqname>@umich.edu - ans-A
xz xz xz xzxz
Why do we use Makefiles?
xz xz xz xz
A. They can create the submission files automatically.
xz xz xz xz xz xz xz
B. They automate the (sometimes long and complex) compilation process for us.
xz xz xz xz xz xz xz xz xz xz xz
C. They can run custom testing scripts.
xz xz xz xz xz xz
D. Typing out compilation commands every time is annoying.
xz xz xz xz xz xz xz xz
E. All of the above. - ans-E
xz xz xz xz xz xzxz
Will your program compile on the autograder without the project identifier?
xz xz xz xz xz xz xz xz xz xz
A. Yes.
xz
B. NO, and I'll potentially waste the submission. - ans-B
xz xz xz xz xz xz xz xz xzxz
What is the Makefile command to create a submission file that includes custom test cases?
xz xz xz xz xz xz xz xz xz xz xz xz xz xz
A. make
xz
B. make all
xz xz
C. make partialsubmit
xz xz
D. make fullsubmit - ans-D
xz xz xz xzxz
Which of the following is a debugging tool?
xz xz xz xz xz xz xz
A. Makefile
xz
B. perf
xz
C. valgrind
xz
D. cin - ans-C
xz xz xzxz
What does perf do? xz xz xz
, A. Detects segmentation faults in a program and displays line numbers that they occurred a
xz xz xz xz xz xz xz xz xz xz xz xz xz xz
t.
B. Profiles program execution time.
xz xz xz xz
C. Profiles program memory usage.
xz xz xz xz
D. Automates the testing process. - ans-B
xz xz xz xz xz xzxz
What is wrong with the following program?
xz xz xz xz xz xz
int add ( int a , int b );
xz xz xz xz xz xz xz xz
int main () {
xz xz xz
int x = 1;
xz xz xz xz
int y = 5;
xz xz xz xz
return add (x , y );
xz xz xz xz xz xz
}
A. add() has no definition.
xz xz xz xz
B. add() is called with x and y, but accepts a and b.
xz xz xz xz xz xz xz xz xz xz xz xz
C. The program does not compile because main() cannot return a value of 6.
xz xz xz xz xz xz xz xz xz xz xz xz xz
D. A function cannot be called after a return statement.
xz xz xz xz xz xz xz xz xz
E. Nothing is wrong with this program. - ans-A
xz xz xz xz xz xz xz xzxz
What is wrong with the following program?
xz xz xz xz xz xz
int main () {
xz xz xz
int x = 0;
xz xz xz xz
return x + y ;
xz xz xz xz xz
}
A. main() cannot return the result of an arithmetic expression.
xz xz xz xz xz xz xz xz xz
B. main() cannot return x + y because x + y is a double.
xz xz xz xz xz xz xz xz xz xz xz xz xz
C. main() does not contain a declaration for y.
xz xz xz xz xz xz xz xz
D. main() cannot return an integer.
xz xz xz xz xz
E. Nothing is wrong with this program. - ans-C
xz xz xz xz xz xz xz xzxz
What is wrong with the following program?
xz xz xz xz xz xz
# include < vector >
xz xz xz xz
int * get_some_ints () {
xz xz xz xz
std :: vector < int > ints = {1 , 2 , 3 , 4 , 5};
xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz
return ints . data ();
xz xz xz xz xz
}
int main () {
xz xz xz
int * some_ints = get_some_ints ();
xz xz xz xz xz xz
delete [] some_ints ;
xz xz xz xz
return 0;
xz xz
}
A. The memory pointed to by some ints is freed twice.
xz xz xz xz xz xz xz xz xz xz
B. main() leaks the memory pointed to by some ints.
xz xz xz xz xz xz xz xz xz
C. A function cannot return a pointer.
xz xz xz xz xz xz
ANSWERS
What is the correct login string for CAEN?
xz xz xz xz xz xz xz
NOTE:In this class, when we want to indicate that you should use a variable but we are writi
xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz
ngtext in a document, we will surround the variable with < and >. For example, for optionA in
xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz x
the following answers, Dr. Paoletti's personal login string would .u
z xz xz xz xz xz xz xz xz xz
mich.edu, because he would replace <uniqname> with his uniqname(paoletti).
xz xz xz xz xz xz xz xz
A. ssh <uniqname>@login.engin.umich.edu
xz xz
B. ssh <uniqname>@engin.umich.edu
xz xz
C. ssh <uniqname>@caen.umich.edu
xz xz
D. ssh <uniqname>@umich.edu - ans-A
xz xz xz xzxz
Why do we use Makefiles?
xz xz xz xz
A. They can create the submission files automatically.
xz xz xz xz xz xz xz
B. They automate the (sometimes long and complex) compilation process for us.
xz xz xz xz xz xz xz xz xz xz xz
C. They can run custom testing scripts.
xz xz xz xz xz xz
D. Typing out compilation commands every time is annoying.
xz xz xz xz xz xz xz xz
E. All of the above. - ans-E
xz xz xz xz xz xzxz
Will your program compile on the autograder without the project identifier?
xz xz xz xz xz xz xz xz xz xz
A. Yes.
xz
B. NO, and I'll potentially waste the submission. - ans-B
xz xz xz xz xz xz xz xz xzxz
What is the Makefile command to create a submission file that includes custom test cases?
xz xz xz xz xz xz xz xz xz xz xz xz xz xz
A. make
xz
B. make all
xz xz
C. make partialsubmit
xz xz
D. make fullsubmit - ans-D
xz xz xz xzxz
Which of the following is a debugging tool?
xz xz xz xz xz xz xz
A. Makefile
xz
B. perf
xz
C. valgrind
xz
D. cin - ans-C
xz xz xzxz
What does perf do? xz xz xz
, A. Detects segmentation faults in a program and displays line numbers that they occurred a
xz xz xz xz xz xz xz xz xz xz xz xz xz xz
t.
B. Profiles program execution time.
xz xz xz xz
C. Profiles program memory usage.
xz xz xz xz
D. Automates the testing process. - ans-B
xz xz xz xz xz xzxz
What is wrong with the following program?
xz xz xz xz xz xz
int add ( int a , int b );
xz xz xz xz xz xz xz xz
int main () {
xz xz xz
int x = 1;
xz xz xz xz
int y = 5;
xz xz xz xz
return add (x , y );
xz xz xz xz xz xz
}
A. add() has no definition.
xz xz xz xz
B. add() is called with x and y, but accepts a and b.
xz xz xz xz xz xz xz xz xz xz xz xz
C. The program does not compile because main() cannot return a value of 6.
xz xz xz xz xz xz xz xz xz xz xz xz xz
D. A function cannot be called after a return statement.
xz xz xz xz xz xz xz xz xz
E. Nothing is wrong with this program. - ans-A
xz xz xz xz xz xz xz xzxz
What is wrong with the following program?
xz xz xz xz xz xz
int main () {
xz xz xz
int x = 0;
xz xz xz xz
return x + y ;
xz xz xz xz xz
}
A. main() cannot return the result of an arithmetic expression.
xz xz xz xz xz xz xz xz xz
B. main() cannot return x + y because x + y is a double.
xz xz xz xz xz xz xz xz xz xz xz xz xz
C. main() does not contain a declaration for y.
xz xz xz xz xz xz xz xz
D. main() cannot return an integer.
xz xz xz xz xz
E. Nothing is wrong with this program. - ans-C
xz xz xz xz xz xz xz xzxz
What is wrong with the following program?
xz xz xz xz xz xz
# include < vector >
xz xz xz xz
int * get_some_ints () {
xz xz xz xz
std :: vector < int > ints = {1 , 2 , 3 , 4 , 5};
xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz xz
return ints . data ();
xz xz xz xz xz
}
int main () {
xz xz xz
int * some_ints = get_some_ints ();
xz xz xz xz xz xz
delete [] some_ints ;
xz xz xz xz
return 0;
xz xz
}
A. The memory pointed to by some ints is freed twice.
xz xz xz xz xz xz xz xz xz xz
B. main() leaks the memory pointed to by some ints.
xz xz xz xz xz xz xz xz xz
C. A function cannot return a pointer.
xz xz xz xz xz xz