1. How do you create a Rust project on the command-line?
Answer
Correct Answer:
Cargo new
Note: This Question is unanswered, help us to find answer for this one
2. Generics are useful when you _.
Answer
Correct Answer:
Need to reduce code duplication by abstracting values further, such as in function parameters
Note: This Question is unanswered, help us to find answer for this one
3. What is a safe operation on a std::cell:UnsafeCell?
Answer
Correct Answer:
The only safe operation is the .get() method, which returns only a raw pointer.
Note: This Question is unanswered, help us to find answer for this one
4. What does an underscore (_) indicate when used as pattern?
Answer
Correct Answer:
It matches everything.
Note: This Question is unanswered, help us to find answer for this one
5. Which statement about enums is false?
Answer
Correct Answer:
The term enum is short for enummap
Note: This Question is unanswered, help us to find answer for this one
6. Which choice is not valid loop syntax?
Answer
Correct Answer:
Do
Note: This Question is unanswered, help us to find answer for this one
7. Your application requires a single copy of some data type T to be held in memory that can be accessed by multiple threads. What is the thread-safe wrapper type?
Answer
Correct Answer:
Arc>
Note: This Question is unanswered, help us to find answer for this one
8. Which types are not allowed within an enum variant's body?
Answer
Correct Answer:
Trait objects
Note: This Question is unanswered, help us to find answer for this one
9. What smart pointer is used to allow multiple ownership of a value in various threads?
Answer
Correct Answer:
Arc
Note: This Question is unanswered, help us to find answer for this one
10. Which statement about the Clone and Copy traits is false?
Answer
Correct Answer:
Copy is enabled for primitive, built-in types.
Note: This Question is unanswered, help us to find answer for this one
11. When used as a return type, which Rust type plays a similar role to Python's None, JavaScript's null, or the void type in C/C++?
Answer
Correct Answer:
()
Note: This Question is unanswered, help us to find answer for this one
12. Which statement about lifetimes is false?
Answer
Correct Answer:
Lifetimes are always inferred by the compiler.
Note: This Question is unanswered, help us to find answer for this one
13. Defining a _ requires a lifetime parameter.
Answer
Correct Answer:
Struct that contains a reference to a value
Note: This Question is unanswered, help us to find answer for this one
14. In matching patterns, values are ignored with _.
Answer
Correct Answer:
..
Note: This Question is unanswered, help us to find answer for this one
15. Which comment syntax is not legal?
Answer
Correct Answer:
#
Note: This Question is unanswered, help us to find answer for this one
16. What happens when an error occurs that is being handled by the question mark (?) operator?
Answer
Correct Answer:
Rust attempts to convert the error to the local function's error type and return it as Result::Err. If that fails, the program panics.
Note: This Question is unanswered, help us to find answer for this one
17. The smart pointers Rc and Arc provide reference counting. What is the API for incrementing a reference count?
Answer
Correct Answer:
.clone()
Note: This Question is unanswered, help us to find answer for this one
18. Which is valid syntax for defining an array of i32 values?
Answer
Correct Answer:
[i32; 10]
Note: This Question is unanswered, help us to find answer for this one
19. Using the ? operator at the end of an expression is equivalent to _.
Answer
Correct Answer:
A match pattern that may result an early return
Note: This Question is unanswered, help us to find answer for this one
20. The term box and related phrases such as boxing a value are often used when relating to memory layout. What does box refer to?
Answer
Correct Answer:
It's creating a pointer on the stack that points to a value on the heap.
Note: This Question is unanswered, help us to find answer for this one
21. Which cargo command checks a program for error without creating a binary executable?
Answer
Correct Answer:
Cargo check
Note: This Question is unanswered, help us to find answer for this one
22. _ cannot be destructured.
Answer
Correct Answer:
Traits
Note: This Question is unanswered, help us to find answer for this one
23. Which choice is not a scalar data type?
Answer
Correct Answer:
Tuple
Note: This Question is unanswered, help us to find answer for this one
24. Which type cast preserves the mathematical value in all cases?
Answer
Correct Answer:
I32 as i64
Note: This Question is unanswered, help us to find answer for this one
25. Which of the following provides the most random seed source for a pseudo random number generator?
Answer
Correct Answer:
/dev/random
Note: This Question is unanswered, help us to find answer for this one
26. The purpose of the poll() and select() system calls is to perform which of the following functions?
Answer
Correct Answer:
Watch a set of file descriptors to see which are ready
Note: This Question is unanswered, help us to find answer for this one
27. You want to listen on a port for some user-defined data stream. Would you use port 80?
Answer
Correct Answer:
No, it is best to use three or four digit port numbers.
Note: This Question is unanswered, help us to find answer for this one
28. Race conditions are caused by which of the following conditions in a multi threaded system?
Answer
Correct Answer:
Proper program function is dependent on the execution sequence and timing of each thread
Note: This Question is unanswered, help us to find answer for this one
29. An orphan process occurs as a result of which of the following conditions?
Answer
Correct Answer:
Parent process terminates before its child process
Note: This Question is unanswered, help us to find answer for this one
30. When a new process is created using fork(), which of the following describes the state of open file descriptors?
Answer
Correct Answer:
The child overwrites the parent’s
Note: This Question is unanswered, help us to find answer for this one
31. Which of the following is correct for the standard file descriptors that are automatically opened in UNIX?