Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 23 discussion

Actual exam question from Salesforce's CRT-450
Question #: 23
Topic #: 1
[All CRT-450 Questions]

A developer has the controller class below.

Which code block will run successfully in an execute anonymous window?

  • A. myFooController m = new myFooController(); System.assert(m.prop !=null);
  • B. myFooController m = new myFooController(); System.assert(m.prop ==0);
  • C. myFooController m = new myFooController(); System.assert(m.prop ==null);
  • D. myFooController m = new myFooController(); System.assert(m.prop ==1);
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
kimmaayyaa
Highly Voted 2 years, 3 months ago
c is correct answer The reason is that the value of prop variable is never defined in the constructor of controller hence it is null
upvoted 5 times
...
Ankit_Swami
Most Recent 4 months, 3 weeks ago
Selected Answer: C
If you declare a variable and don't initialize it with a value, it will be null. In essence, null means the absence of a value.
upvoted 1 times
...
TDB97
5 months ago
All the code will run successfully, but not all of them will return true.. But yes C would be correct if we solve for true
upvoted 2 times
...
1vanTT
1 year, 6 months ago
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_variables.htm
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...