Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam CRT-600 Topic 7 Question 73 Discussion

Actual exam question for Salesforce's CRT-600 exam
Question #: 73
Topic #: 7
[All CRT-600 Questions]

Refer to the following code:

class Vehicle{

constructor(plate){

this.plate = plate;

}

}

class Truck extends Vehicle{

constructor(plate, weight){

//Missing code

this.weight = weight;

}

displayWeight(){

console.log(`The truck ${this.plate} has a weight of ${this.weight}lb.`);

}

}let myTruck = new Truck('123Ab',5000);

myTruck.displayWeight();

Which statement should be added to missing code for the code to display 'The truck 123AB has a

weight of 5000lb.

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Tawna
5 months ago
As a truck enthusiast, I can tell you that the correct answer is definitely D. Anything else would be a load of rubbish!
upvoted 0 times
...
Lashaunda
5 months ago
Option D is the way to go. Why would we need to use `super.plate = plate` or `Vehicle.plate = plate`? That doesn't seem right.
upvoted 0 times
Jaclyn
5 months ago
Using super.plate = plate or Vehicle.plate = plate would not work in this case.
upvoted 0 times
...
Carylon
5 months ago
Option D is correct. It assigns the plate value to the Truck instance.
upvoted 0 times
...
...
Tonja
6 months ago
Hmm, this is a tricky one. I'm leaning towards option B, but I'm not 100% sure. I wonder if the instructor is trying to trick us.
upvoted 0 times
Leonora
5 months ago
I agree, option B makes sense. It sets the plate value using super.
upvoted 0 times
...
Junita
5 months ago
I think option B is correct. It assigns the plate value to the Truck class.
upvoted 0 times
...
...
Dell
6 months ago
I'm pretty sure it's option A. The `super()` call is used to invoke the constructor of the parent class.
upvoted 0 times
Shad
5 months ago
Yes, that's correct. Option A is the right choice.
upvoted 0 times
...
Krystal
5 months ago
I agree, using super(plate) will call the constructor of the parent class.
upvoted 0 times
...
Kirk
5 months ago
A) super(plate)
upvoted 0 times
...
...
Blossom
6 months ago
I agree with Alberto, using super(plate) will call the constructor of the parent class and pass the plate parameter
upvoted 0 times
...
Alberto
6 months ago
I think the answer is A) super(plate)
upvoted 0 times
...
Angelo
6 months ago
Option D makes the most sense. We need to call the constructor of the parent class, which is Vehicle, and pass the plate parameter to it.
upvoted 0 times
Curt
5 months ago
Yes, you're right. Using 'this.plate = plate' will set the plate property of the Truck class to the value passed in the constructor.
upvoted 0 times
...
Curt
5 months ago
Option D makes the most sense. We need to call the constructor of the parent class, which is Vehicle, and pass the plate parameter to it.
upvoted 0 times
...
Pamella
5 months ago
Yes, you're right. Using 'this.plate = plate' in the Truck constructor will assign the plate value correctly.
upvoted 0 times
...
Macy
5 months ago
I agree, 'super(plate)' is the correct statement to add in the missing code for the code to display the desired output.
upvoted 0 times
...
Victor
6 months ago
Yes, you're right. Using 'super(plate)' would call the constructor of the parent class and pass the plate parameter.
upvoted 0 times
...
Ethan
6 months ago
Option D makes the most sense. We need to call the constructor of the parent class, which is Vehicle, and pass the plate parameter to it.
upvoted 0 times
...
Rueben
6 months ago
Option D makes the most sense. We need to call the constructor of the parent class, which is Vehicle, and pass the plate parameter to it.
upvoted 0 times
...
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77