BlackFriday 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
4 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
4 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
4 months ago
Using super.plate = plate or Vehicle.plate = plate would not work in this case.
upvoted 0 times
...
Carylon
4 months ago
Option D is correct. It assigns the plate value to the Truck instance.
upvoted 0 times
...
...
Tonja
5 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
4 months ago
I agree, option B makes sense. It sets the plate value using super.
upvoted 0 times
...
Junita
4 months ago
I think option B is correct. It assigns the plate value to the Truck class.
upvoted 0 times
...
...
Dell
5 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
4 months ago
Yes, that's correct. Option A is the right choice.
upvoted 0 times
...
Krystal
4 months ago
I agree, using super(plate) will call the constructor of the parent class.
upvoted 0 times
...
Kirk
4 months ago
A) super(plate)
upvoted 0 times
...
...
Blossom
5 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
5 months ago
I think the answer is A) super(plate)
upvoted 0 times
...
Angelo
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
Curt
4 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
4 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
4 months ago
Yes, you're right. Using 'this.plate = plate' in the Truck constructor will assign the plate value correctly.
upvoted 0 times
...
Macy
4 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
5 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
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
...
Rueben
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
...
...

Save Cancel