Jetzt registrieren

Anmeldung

Passwort verloren

Passwort vergessen? Geben Sie bitte Ihre Email-Adresse ein. Sie erhalten einen Link und ein neues Passwort per E-Mail erstellen.

Eintrag

Sie müssen sich anmelden Beitrag hinzufügen .

In Frage

Sie müssen sich anmelden, um eine Frage zu stellen.

Anmeldung

Jetzt registrieren

Willkommen bei Scholarsark.com! Ihre Anmeldung wird gewährt Ihnen Zugriff auf mehr Funktionen dieser Plattform. Sie können Fragen stellen, beitragspflichtig oder geben Antworten, Ansicht Profile anderer Nutzer und vieles mehr. Jetzt registrieren!

Antworten und Fragen zur LinkedIn-Fähigkeitsbewertung – Rust (Programmiersprache)

Rost ist eine moderne und innovative Programmiersprache, die aufgrund ihres Fokus auf Leistung an Popularität gewonnen hat, Sicherheit, und Parallelität. In diesem umfassenden Ratgeber, Wir freuen uns, eine Reihe davon präsentieren zu können Fragen zur Kompetenzbewertung und Antworten speziell zugeschnitten auf Rost Benutzer.

Egal, ob Sie ein erfahrener Entwickler sind, der seine Fähigkeiten erweitern möchte, oder ein Anfänger, der die Grundlagen dieser leistungsstarken Sprache verstehen möchte, Diese Ressource soll Ihnen dabei helfen, sich darin zurechtzufinden Rost und seine Anwendungen. Begleiten Sie uns, während wir die Kernkonzepte von erkunden Rust-Programmierung, einschließlich Eigentum, Ausleihen, Lebenszeiten, und mehr, So können Sie das volle Potenzial dieser hochmodernen Sprache ausschöpfen.”

Q1. Welche Typumwandlung behält den mathematischen Wert in allen Fällen bei??

  • i64 wie i32
  • Verwenden Sie es als u64
  • i32 wie i64
  • f64 wie f32

Q2. Was bedeuten hier die vertikalen Balken??

str::thread::spawn(|| {
    println!("LinkedIn");
});
  • eine Schließung
  • ein Thread
  • eine Zukunft
  • Ein Block

Referenz

Q3. Welche Auswahl ist kein skalarer Datentyp??

  • ganze Zahl
  • schweben
  • Boolescher Wert
  • Tupel

Q4. Sobald Sie den Kurs abgeschlossen haben kann nicht zerstört werden.

  • Züge
  • Tupel
  • Aufzählungen
  • Strukturen

Referenz

Q5. Welche cargo Der Befehl überprüft ein Programm auf Fehler, ohne eine binäre ausführbare Datei zu erstellen?

  • Ladung –ROS2-Robotik-Entwicklerkurs
  • Frachtinit
  • Frachtbau
  • Frachtkontrolle

Q6. Der Begriff Box und verwandte Phrasen wie einen Wert boxen werden häufig im Zusammenhang mit dem Speicherlayout verwendet. Was macht Box beziehen auf?

  • Es wird ein Zeiger auf dem Heap erstellt, der auf einen Wert auf dem Stapel zeigt.
  • Es wird ein Zeiger auf dem Stapel erstellt, der auf einen Wert auf dem Heap zeigt.
  • Es wird ein Speicherschutz um Werte herum erstellt, um illegalen Zugriff zu verhindern.
  • Es ist eine Abstraktion, die sich auf Eigentum bezieht. “Verpackt” Die Werte sind deutlich gekennzeichnet.

Q7. Was ist eine alternative Schreibweise? slice das führt zum gleichen Ergebnis?

...
let s = String::form("hello");
let slice = &s[0..2];
  • in Scheiben schneiden lassen = &s[len + 2];
  • in Scheiben schneiden lassen = &s[len – 2];
  • in Scheiben schneiden lassen = &s.kopieren(0..2);
  • in Scheiben schneiden lassen = &s[..2];

Q8. Verwendung der ? Der Operator am Ende eines Ausdrucks ist äquivalent zu Sobald Sie den Kurs abgeschlossen haben.

  • ein Übereinstimmungsmuster, das in „Wahr“ oder „Falsch“ verzweigt
  • Aufruf von ok_error()
  • Panik ausrufen!()
  • ein Übereinstimmungsmuster, das zu einer vorzeitigen Rückkehr führen kann

Q9. Which is valid syntax for defining an array of i32 values?

  • Array::with_capacity(10)
  • [i32]
  • Array::Neu(10)
  • [i32; 10]

Q10. What syntax is required to take a mutable reference to T, when used within a function argument?

fn increment(i: T) {
    // body elided
}
  • *mut T
  • mut ref T
  • mut &T
  • &mut T

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

  • .hinzufügen()
  • .incr()
  • .Klon()
  • .increment()

Referenz

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

  • The error is reported and execution continues.
  • An exception is raised. The effect(s) of the exception are defined by the error! macro.
  • The program panics immediately.
  • 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.

Q13. Which comment syntax is not legal?

  • /*
  • #
  • //!
  • //

F14. In matching patterns, values are ignored with _.

  • .ignore()
  • an underscore (_)
  • ..
  • überspringen

Q15. Defining a _ requires a lifetime parameter.

  • function that ends the lifetime of one of its arguments
  • struct that contains a reference to a value
  • function with a generic argument
  • struct that contains a reference to a boxed value

Rust book reference

Q16. Which example correctly uses std::Sammlungen::HashMap’s Entry API to populate counts?

use std::collections::HashMap;
fn main() {
    let mut counts = HashMap::new();
    let text = "LinkedIn Learning";
    for c in text.chars() {
        // Complete this block
    }
    println!("{:?}", counts);
}
  • ­
for c in text.chars() {
    if let Some(count) = &mut counts.get(&c) {
        counts.insert(c, *count + 1);
    } else {
        counts.insert(c, 1);
    };
}
  • ­
for c in text.chars() {
    let count = counts.entry(c).or_insert(0);
    *count += 1;
}
  • ­
for c in text.chars() {
    let count = counts.entry(c);
    *count += 1;
}
  • ­
for c in text.chars() {
    counts.entry(c).or_insert(0).map(|x| x + 1);
}

Referenz

Q17. Which fragment does not incur memory allocations while writing to a “Datei” (represented by a Vec)?

use std::collections::HashMap;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut v = Vec::<u8>::new();

    let a = "LinkedIn";
    let b = 123;
    let c = '🧀';

    // replace this line

    println!("{:?}", v);

    Ok(())
}
  • :
write!(&mut v, "{}{}{}", a, b, c)?;
  • :
v.write(a)?;
v.write(b)?;
v.write(c)?;
  • :
v.write(a, b, c)?;
  • :
v.write_all(a.as_bytes())?;
v.write_all(&b.to_string().as_bytes())?;
c.encode_utf8(&mut v);
  1. Answered in rust user forum
  2. Referenz

Q18. Does the main function compile? Wenn ja, Warum? Wenn nicht, what do you need to change?

fn main() {
    let Some(x) = some_option_value;
}
  • The code does not compile. let statements require a refutable pattern. Hinzufügen if Vor let.
  • The code compiles. let statements sometimes require a refutable pattern.
  • The code does not compile. let statements requires an irrefutable pattern. Hinzufügen if Vor let.
  • The code compiles. let do not require a refutable pattern.

Q19. Which statement about lifetimes is false?

  • Lifetimes were redundantly specified in previous version of Rust.
  • Lifetimes are specified when a struct is holding a reference to a value.
  • Lifetimes are specified when certain values must outlive others.
  • Lifetimes are always inferred by the compiler.

Q20. When used as a return type, which Rust type plays a similar role to Python’s None, JavaScript’s null, oder der void type in C/C++?

  • !
  • None
  • Null
  • ()

Q21. To convert a Result to an Option, which method should you use?

  • .as_option()
  • .ok()
  • .to_option()
  • .into()

Q22. Which statement about the Clone und Copy traits is false?

  • Copy is enabled for primitive, built-in types.
  • ZWEI Copy, Rust applies move semantics to a type’s access.
  • When using Clone, copying data is explicit.
  • Until a type implements either Copy oder Clone, its internal data cannot be copied.

ref from stack overflow

Q23. Why does this code nicht compile?

fn returns_closure() -> dyn Fn(i32) -> i32 {
    |x| x + 1
}
  • The returned fn pointer and value need to be represented by another trait.
  • Closures are types, so they cannot be returned directly from a function.
  • Closures are types and can be returned only if the concrete trait is implemented.
  • Closures are represented by traits, so they cannot be a return type.

Rust book reference

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

  • Arc<T>
  • Box<T>
  • Beide Arc<T> und Rc<T> are multithread safe.
  • Rc<T>

Rust book reference

Q25. Which types are nicht allowed within an enum variant’s body?

  • zero-sized types
  • Erstellen Sie im ersten Teil die Drag-Geste und die Karten-UI
  • trait objects
  • floating-point numbers

Referenz

Q26. Which statement about this code is true?

fn main() {
    let c = 'z';
    let heart_eyed_cat = '😻';
}
  • Both are character literals.
  • heart_eyed_cat is an invalid expression.
  • c is a string literal and heart_eyed_cat is a character literal.
  • Both are string literals.

Referenz

F27. 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?

  • Mutex<Arc<T>>
  • Rc<Mutex<T>>
  • Arc<Mutex<T>>
  • Mutex<Rc<T>>

Rust book reference

Q28. Which idiom can be used to concatenate the strings a, b, c?

let a = "a".to_string();
let b = "b".to_string();
let c = "c".to_string();
  • String::from(a,b,c)
  • format!("{}{}{}", a, b, c)
  • concat(a,b,c)
  • a + b + c

Q29. In this function. what level of access is provided to the variable a?

use std::fmt::Debug;

fn report<T:Debug>(a: &T) {
    eprintln!("info: {:?}", a);
}
  • drucken
  • read-only
  • read/write
  • debuggen

Q30. Which choice is nicht valid loop syntax?

  • loop
  • for
  • while
  • do

Q31. How do you construct a value of Status that is initialized to Waiting?

enum Status {
    Waiting,
    Busy,
    Error(String),
}
  • let s = Enum::new(Status::Waiting);
  • let s = new Status::Waiting;
  • let s = Status::Waiting;
  • let s = Status::new(Waiting);

Q32. Which statement about enums is false?

  • Enums are useful in matching patterns.
  • Option is an enum type.
  • Enum variants can have different types with associated data.
  • der Begriff enum is short for enummap

Q33. What does an underscore (Sobald Sie den Kurs abgeschlossen haben) indicate when used as pattern?

  • It matches everything.
  • It matches underscores.
  • It matches any value that has a length of 1.
  • It matches nothing.

Q34. What is a safe operation on a std::cell:UnsafeCell<T>?

  • EIN &mut T reference is allowed. However it may not cpexists with any other references. and may be created only in single-threaded code.
  • UnsafeCell<T> provides thread-safety. Deshalb, Erstellen &T references from multiple threads is safe.
  • The only safe operation is the .get() Methode, which returns only a raw pointer.
  • Non. UnsafeCell<T> only allows code that would otherwise need unsafe blocks to be written in safe code.

Referenz

Q35. Generics are useful when you Sobald Sie den Kurs abgeschlossen haben.

  • need to reduce code duplication by concretizing values and restricting parameters in functions
  • need to reduce code duplication by abstracting values further, such as in function parameters
  • need a supertrait
  • are not sure if you need a specific kind of trait

Q36. How do you create a Rust project on the command-line?

  • cargo new
  • rustup init
  • cargo start
  • rust new-project

Q37. Calling.clone() Sobald Sie den Kurs abgeschlossen haben.

  • deeply copies heap data and clones ownership
  • clones the pointer to the heap
  • clones the heap data onto the stack
  • deeply copies heap and stack

Referenz

Q38. what is one of the roles of the let keyword?

let text = String::new("LinkedIn");
  • Create a text object.
  • Assign a mutable value.
  • request to borrow a string.
  • Assign an immutable value.

Referenz

Q39. How is a new enum initialized?

enum Option_i32 {
    Some(i32),
    None,
}
  • let integer = Option_i32::Etwas(5);
  • let integer = Option_i32.new(Etwas(5))
  • let integer = Option_i32::Neu::(Etwas(5))
  • let integer = Option_i32.init()

Referenz

Q40. What are the main difference between const and static?

  • They can be used interchangeably, but const only supports primitive types while static must be used for structs and user-defined types.
  • They can be used interchangeably, but const values are compiled at compile time.
  • Values defined with const live in the stack, while static values live on the heap.
  • Values defined with const can be copied to wherever they are needed, whereas static values remain in a fixed place in memory.

Referenz

Q41. Which Rust data type represents a signed integer that has the same width as a pointer of the compile target’s CPU?

  • i64
  • int64
  • isize
  • int

Referenz

Q42. When are supertraits needed?

  • when a trait is needed for multiple structs
  • when a trait depends on another trait
  • only when a generic trait is used
  • when a metatrait is needed to use another trait

Referenz

Q43. Which types are legal for x to be in this snippet?

if x {
    println!("ok");
}
  • every type that implements the std::cmp::Truth trait
  • only the primitive bool type
  • both bool and u8 (which is how bool is implemented under the hood)
  • bool and std::sync::atomic::AtomicBool

Referenz

Q44. How do you access the married data in this struct?

struct person = Person {
    height: u64,
    weight: u64,
    married: bool
}
  • person.getMarried()
  • Person[married]
  • person.value(married)
  • person.married

Referenz

Q45. To mark a function as visible to other crates, what do you need to do to its definition?

  • Add the public keyword.
  • Add the pub keywork.
  • Begin the function’s name with a capital letter.
  • Remove the private keyword.

Referenz

Q46. Which choice is a compound data type?

  • verkohlen
  • Tupel
  • bool
  • i32

Referenz

Q47. How could you make this function compile?

fn main() {
    let x = 5;
    println!("The value of x is: {}", x);
    x = 6;
    println!("The value of x is: {}", x);
}
  • Use x only once in a println!() Stellungnahme.
  • Place curly brackets around let x = 5.
  • Add const to let x = 6.
  • Add mut to let x = 5.

Referenz

Q48. Using .unwrap() will _.

  • let you choose the expected panic error message
  • call panic! if there is an error or absence of value
  • unwrap the value inside an unsafe wrapper
  • return the error inside Ok()

Referenz

Q49. When should the panic! macro be called instead of using std::Ergebnis::Result?

  • when there is a way to encode the information in types used
  • when your code is expected to end in a good state
  • when the situation is considered unrecoverable
  • when valid values are passed on the code

Referenz

Q50. Which statement about arrays is true?

  • [; size of array] can initialize arrays.
  • Indizierung, such as array.0, accesses elements in arrays.
  • A data structure for collections can contain different types of values.
  • Arrays are useful when you want to allocate data on the heap and then on the stack.

Referenz

Q51. How would you select the value 2.0 from this tuple?

let pt = Point2D(-1.0, 2.0)
  • pt[1]
  • pt(1)
  • pt.iter().nth(1)
  • pt.1

Referenz

Q52. When writing tests, which macro should you use to assert equality between two values?

  • assert_eq!()
  • assert_equal!()
  • is_equals!()
  • assert!()

Referenz

Q53. Which code statement in Rust is used to define a BTreeMap object?

  • let btm=BTreeMap::Neu()
  • let mut btm=BTreeMap::Neu()
  • BTreeMap btm = BTreeMap.new()
  • BTreeMap btm = std::Sammlungen::BTreeMap::Neu()

Referenz

Q54 .Rust is known to be memory safe. Which feature is the main reason for the memory safety of Rust?

  • ownership
  • Ausleihen
  • Lebenszeiten
  • Referenz

Referenz

Q55 . To support Dynamic Sized variables, what should we use in place off32”?

  • Not supportedin Rust
  • use array
  • ?sized
  • list all data-types

Referenz

Q56 . Was ist “Dropin Rust used for?

  • run code as multi-threaded
  • run code when variable is out of scope
  • run code and drop it if error comes
  • Möglichkeit 4

Referenz

Q57 . In Rust, how is a macro from the above Rust code snippet used?

  • foo(x)
  • #foo
  • foo!()
  • foo

Referenz

Q58 . Which library does Rust use for memory allocation?

  • tcmalloc
  • mimalloc
  • ptmalloc
  • jemalloc

Referenz

Q59 . Who designed Rust from scratch in 2006?

  • Graydon Hoare
  • Yukihiro Matsumoto
  • Guido Van Rossum
  • David flanagan

Referenz

Q60. Which types are nicht allowed within an enum variant’s body?

  • zero-sized types
  • Erstellen Sie im ersten Teil die Drag-Geste und die Karten-UI
  • trait objects
  • floating-point numbers

Q61. Which example correctly uses std::Sammlungen::HashMap’s Entry API to populate counts?

use std::collections::HashMap;
fn main() {
    let mut counts = HashMap::new();
    let text = "LinkedIn Learning";
    for c in text.chars() {
        // Complete this block
    }
    println!("{:?}", counts);
}
  • ­
for c in text.chars() {
    if let Some(count) = &mut counts.get(&c) {
        counts.insert(c, *count + 1);
    } else {
        counts.insert(c, 1);
    };
}
  • ­
for c in text.chars() {
    let count = counts.entry(c).or_insert(0);
    *count += 1;
}
  • ­
for c in text.chars() {
    let count = counts.entry(c);
    *count += 1;
}
  • ­
for c in text.chars() {
    counts.entry(c).or_insert(0).map(|x| x + 1);
}

Q62. To convert a Result to an Option, which method should you use?

  • .as_option()
  • .ok()
  • .to_option()
  • .into()

Q63. Which statement about this code is true?

fn main() {
    let c = 'z';
    let heart_eyed_cat = '😻';
}
  • Both are character literals.
  • heart_eyed_cat is an invalid expression.
  • c is a string literal and heart_eyed_cat is a character literal.
  • Both are string literals.

Q64. Was ist eine alternative Schreibweise? slice das führt zum gleichen Ergebnis?

...
let s = String::form("hello");
let slice = &s[0..2];
  • in Scheiben schneiden lassen = &s[len + 2];
  • in Scheiben schneiden lassen = &s[len – 2];
  • in Scheiben schneiden lassen = &s.kopieren(0..2);
  • in Scheiben schneiden lassen = &s[..2];

Q65. How would you select the value 2.0 from this tuple?

let pt = Point2D(-1.0, 2.0)
  • pt[1]
  • pt(1)
  • pt.iter().nth(1)
  • pt.1

Q66. What is the purpose of the move keyword in Rust?

  • To indicate that a value should be moved instead of copied.
  • To indicate that a value should be copied instead of moved.
  • To indicate that a value should be borrowed instead of owned.
  • To indicate that a value should be owned instead of borrowed.

Referenz

Autor

  • Helen Bassey

    Hi, I'm Helena, ein Blog-Autor, dessen Leidenschaft es ist, aufschlussreiche Inhalte im Bildungsbereich zu veröffentlichen. Ich glaube, dass Bildung der Schlüssel zur persönlichen und sozialen Entwicklung ist, und ich möchte mein Wissen und meine Erfahrung mit Lernenden jeden Alters und jeder Herkunft teilen. Auf meinem Blog, finden Sie Artikel zu Themen wie Lernstrategien, Online-Bildung, Berufsberatung, und mehr. Ich freue mich auch über Rückmeldungen und Anregungen meiner Leser, Hinterlassen Sie also jederzeit einen Kommentar oder kontaktieren Sie mich. Ich wünsche Ihnen viel Spaß beim Lesen meines Blogs und hoffe, dass Sie ihn nützlich und inspirierend finden.

    Alle Beiträge ansehen

Über Helen Bassey

Hi, I'm Helena, ein Blog-Autor, dessen Leidenschaft es ist, aufschlussreiche Inhalte im Bildungsbereich zu veröffentlichen. Ich glaube, dass Bildung der Schlüssel zur persönlichen und sozialen Entwicklung ist, und ich möchte mein Wissen und meine Erfahrung mit Lernenden jeden Alters und jeder Herkunft teilen. Auf meinem Blog, finden Sie Artikel zu Themen wie Lernstrategien, Online-Bildung, Berufsberatung, und mehr. Ich freue mich auch über Rückmeldungen und Anregungen meiner Leser, Hinterlassen Sie also jederzeit einen Kommentar oder kontaktieren Sie mich. Ich wünsche Ihnen viel Spaß beim Lesen meines Blogs und hoffe, dass Sie ihn nützlich und inspirierend finden.

Hinterlasse eine Antwort