Rust (programming language)/Rust Programming Language Mcq Sample Test,Sample questions

Question:
An orphan process occurs as a result of which of the following conditions?

1.Parent and child process terminate simultaneously

2.Child process terminates before its parent process

3.Parent process terminates before its child process

4.None of these

Posted Date:-2022-08-07 11:13:48


Question:
CORBA's DII allows a client to do which one of the following?

1.Generate client-side stubs for interfaces

2.Dynamically link with cross-platform libs

3.Connect with proxy objects across platforms

4.Discover new objects and interfaces at runtime

Posted Date:-2022-08-07 08:25:22


Question:
Defining a _ requires a lifetime parameter.

1.Function that ends the lifetime of one of its arguments

2.Struct that contains a reference to a value

3.Function with a generic argument

4.Struct that contains a reference to a boxed value

Posted Date:-2022-08-07 12:15:33


Question:
Generics are useful when you _.

1.Need to reduce code duplication by concretizing values and restricting parameters in functions

2.Need to reduce code duplication by abstracting values further, such as in function parameters

3.Need a supertrait

4.Are not sure if you need a specific kind of trait

Posted Date:-2022-08-07 17:09:13


Question:
How do you create a Rust project on the command-line?

1.Cargo new

2.Rustup init

3.Cargo start

4.Rust new-project

Posted Date:-2022-08-07 17:10:44


Question:
In matching patterns, values are ignored with _.

1..ignore()

2.An underscore (_)

3...

4.Skip

Posted Date:-2022-08-07 12:13:54


Question:
Race conditions are caused by which of the following conditions in a multi threaded system?

1.Proper program function requires all threads to run quickly

2.Proper program function requires that all threads run at the same speed

3. Proper program function is dependent on the execution sequence and timing of

4.None of These

Posted Date:-2022-08-07 11:14:42


Question:
The ioctl() function is used to interact with which of the following?

1.Disk Drives

2. Virtual TTY lines

3.Special character devices

4.None of the above

Posted Date:-2022-08-07 08:18:26


Question:
The purpose of the poll() and select() system calls is to perform which of the following functions?

1.Watch a set of file descriptors to see which are ready

2.Frequently check email and other network services

3.Sample system process information for use by the top command

4.None of these

Posted Date:-2022-08-07 11:24:49


Question:
The result of calling kill(6003, 0) is which of the following?

1. Process 6003 terminates

2.The signal 0 is sent to process 6003

3.The signal 6003 is sent to process 0

4.The existence of process 6003 is checked

Posted Date:-2022-08-07 09:37:19


Question:
The smart pointers Rc and Arc provide reference counting. What is the API for incrementing a reference count?

1..add()

2.incr

3.clone

4.increment

Posted Date:-2022-08-07 12:10:04


Question:
The term box and related phrases such as boxing a value are often used when relating to memory layout. What does box refer to?

1.It's creating a pointer on the heap that points to a value on the stack.

2.It's creating a pointer on the stack that points to a value on the heap.

3.It's creating a memory guard around values to prevent illegal access.

4.It's an abstraction that refers to ownership.

Posted Date:-2022-08-07 11:32:01


Question:
Using the ? operator at the end of an expression is equivalent to

1.A match pattern that branches into True or False

2.Calling ok_error()

3.Calling panic!()

4. A match pattern that may result an early return

Posted Date:-2022-08-07 11:33:45


Question:
What does an underscore (_) indicate when used as pattern?

1.It matches everything.

2.It matches underscores.

3.It matches any value that has a length of 1.

4. It matches nothing

Posted Date:-2022-08-07 16:59:14


Question:
What happens when an error occurs that is being handled by the question mark (?) operator?

1.The error is reported and execution continues.

2.An exception is raised. The effect(s) of the exception are defined by the error! macro

3.The program panics immediately.

4.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.

Posted Date:-2022-08-07 12:11:44


Question:
What is a safe operation on a std::cell:UnsafeCell?

1.A &mut T reference is allowed. However it may not cpexists with any other references. and may be created only in single-threaded code.

2.UnsafeCell provides thread-safety. Therefore, creating &T references from multiple threads is safe.

3.The only safe operation is the .get() method, which returns only a raw pointer.

4.Non. UnsafeCell only allows code that would otherwise need unsafe blocks to be written in safe code.

Posted Date:-2022-08-07 17:00:47


Question:
What smart pointer is used to allow multiple ownership of a value in various threads?

1.Arc

2.Box

3.Both Arc and Rc are multithread safe.

4. Rc

Posted Date:-2022-08-07 12:45:30


Question:
When a new process is created using fork(), which of the following describes the state of open file descriptors?The child inherits the parent’s

1.The child inherits the parent’s

2.The child overwrites the parent’s

3.The child has distinct copies of the parent’s

4.The child always has an empty set of closed descriptors

Posted Date:-2022-08-07 09:55:51


Question:
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++?

1.!

2.None

3.Null

4. ()

Posted Date:-2022-08-07 12:39:27


Question:
Which cargo command checks a program for error without creating a binary executable?

1.Cargo

2.--version

3.Cargo

4.init

Posted Date:-2022-08-07 11:30:59


Question:
Which choice is not a scalar data type?

1.Integer

2.Float

3.Boolean

4.Tuple

Posted Date:-2022-08-07 11:28:29


Question:
Which choice is not valid loop syntax?

1.Loop

2.For

3.While

4.Do

Posted Date:-2022-08-07 12:50:28


Question:
Which comment syntax is not legal?

1./*

2. #

3.//!

4.//

Posted Date:-2022-08-07 12:12:41


Question:
Which is valid syntax for defining an array of i32 values?

1.Array::with_capacity(10)

2.[i32] Array::new(10)

3.[i32; 10]

4.None of the above

Posted Date:-2022-08-07 11:40:37


Question:
Which of the following best describes the purpose of the unlink() call?

1.Removes the file from its directory

2. Sets the file’s Inode count to one (1)

3.Moves the file in from one directory to another

4.All of the above

Posted Date:-2022-08-07 08:19:52


Question:
Which of the following could the fork() command return to the child process?

1.-1

2.2054

3.19456

4.0

Posted Date:-2022-08-07 09:48:26


Question:
Which of the following is correct for the standard file descriptors that are automatically opened in UNIX?

1.STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2

2.STDOUT_FILENO = 0, STDERR_FILENO = 1, STDERR_FILENO = 2

3.STDERR_FILENO = 0, STDOUT_FILENO = 1, STDIN_FILENO = 2

4.STDIN_FILENO = 0, STDERR_FILENO = 1, STDOUT_FILENO = 2

Posted Date:-2022-08-07 09:49:59


Question:
Which of the following is the result of a process calling UNIX exec()?

1.A new process is created

2.The process becomes executable

3.The process is completely overwritten

4.The process blocks waiting for another process to run

Posted Date:-2022-08-07 08:22:50


Question:
Which of the following provides the most random seed source for a pseudo random number generator?

1.C rand() function

2./dev/random

3.both (a) and (b)

4.None of these

Posted Date:-2022-08-07 11:26:10


Question:
Which of the following techniques can help keep system programs secure?

1.Encrypt every process’ executable

2.Setuid important processes to the root user

3.Limit system calls to administrators

4.Check all system calls for error conditions

Posted Date:-2022-08-07 09:45:59


Question:
Which statement about enums is false?

1.Enums are useful in matching patterns.

2.Option is an enum type.

3.Enum variants can have different types with associated data.

4.The term enum is short for enummap

Posted Date:-2022-08-07 16:55:38


Question:
Which statement about lifetimes is false?

1.Lifetimes were redundantly specified in previous version of Rust.

2.Lifetimes are specified when a struct is holding a reference to a value.

3.Lifetimes are specified when certain values must outlive others.

4.Lifetimes are always inferred by the compiler.

Posted Date:-2022-08-07 12:37:54


Question:
Which statement about the Clone and Copy traits is false?

1.Copy is enabled for primitive, built-in types.

2.Without Copy, Rust applies move semantics to a type's access.

3.When using Clone, copying data is explicit.

4.Until a type implements either Copy or Clone, its internal data cannot be copied

Posted Date:-2022-08-07 12:41:12


Question:
Which type cast preserves the mathematical value in all cases?

1.I64 as i32

2.Usize as u64

3.I32 as i64

4.F64 as f32

Posted Date:-2022-08-07 11:27:29


Question:
Which types are not allowed within an enum variant's body?

1.Zero-sized types

2.Structs

3.Trait objects

4.Floating-point numbers

Posted Date:-2022-08-07 12:48:18


Question:
You want to listen on a port for some user-defined data stream. Would you use port 80?

1.No, it is a 'well-defined' or reserved port.

2.No, it is best to use three or four digit port numbers.

3.Yes, it is as good as any other port number.

4.Yes, it is best to use low numbers for port numbers

Posted Date:-2022-08-07 11:22:31


Question:
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?

1.Mutex>

2.Rc>

3.Arc>

4.Mutex>

Posted Date:-2022-08-07 12:49:38


Question:
_ cannot be destructured.

1.Traits

2.Tuples

3.Enums

4.Structs

Posted Date:-2022-08-07 11:29:43


More MCQS

  1. Rust Programming Language Mcq
  2. Rust Programming Language (MCQ)
  3. Rust Multiple Choice Questions
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!