Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Blockchain CBDE Exam - Topic 5 Question 118 Discussion

Actual exam question for Blockchain's CBDE exam
Question #: 118
Topic #: 5
[All CBDE Questions]

To compare a String in Solidity you use:

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

0/2000 characters
Denny
2 months ago
I disagree, A should work in some cases too!
upvoted 0 times
...
Emogene
2 months ago
Wait, you can't compare strings directly? That's surprising!
upvoted 0 times
...
Dana
2 months ago
D is actually a common workaround, but not always reliable.
upvoted 0 times
...
Ashanti
2 months ago
I thought you could just use A? Seems easier.
upvoted 0 times
...
Julianna
3 months ago
C is the way to go, hashing is the best method!
upvoted 0 times
...
Shonda
3 months ago
Hashing strings? What is this, the 1980s? Real developers use the Force to compare strings.
upvoted 0 times
...
Rasheeda
3 months ago
B) sounds like it might work, but I've never heard of that "str_compare" function. Hashing is the way to go.
upvoted 0 times
...
Melinda
3 months ago
D) is interesting, but it's not the best solution. Hashing the strings is more reliable.
upvoted 0 times
...
Daniel
3 months ago
A) is just plain wrong. You can't compare strings like that in Solidity.
upvoted 0 times
...
Thea
4 months ago
C) is the correct answer. Comparing strings directly in Solidity is not possible, so hashing them and comparing the hashes is the way to go.
upvoted 0 times
...
Ceola
4 months ago
I thought we could compare strings directly with ==, but now I'm questioning if that's only for bytes.
upvoted 0 times
...
Herminia
4 months ago
I feel like I saw a practice question that mentioned hashing strings, which makes me lean towards C as well.
upvoted 0 times
...
Miss
4 months ago
C makes sense. Hashing avoids issues with string encoding.
upvoted 0 times
...
Mable
4 months ago
I prefer D. Converting to bytes32 seems straightforward.
upvoted 0 times
...
Daniel
4 months ago
I think it's C. Hashing is the way to go.
upvoted 0 times
...
Sanjuana
5 months ago
A is wrong, right? Direct comparison doesn't work.
upvoted 0 times
...
Viva
5 months ago
I remember something about using bytes32 for comparison, so could it be D? But I'm not entirely sure.
upvoted 0 times
...
Erick
5 months ago
I think you can't directly compare strings in Solidity, so maybe it's C? That sounds familiar.
upvoted 0 times
...
Laticia
6 months ago
I'm a bit confused on this one. I know there are some tricks to comparing strings in Solidity, but I can't recall the exact method. I'll have to review my notes before answering this.
upvoted 0 times
...
Lavera
6 months ago
Ah, I remember learning about this. I believe the correct answer is D - you can convert the strings to bytes32 and then compare them that way. Seems like a straightforward solution.
upvoted 0 times
...
Ben
6 months ago
Hmm, I'm not sure about this one. I know you can't directly compare strings, but I'm not confident which method is the best way to do it. I'll have to think this through carefully.
upvoted 0 times
...
Kina
6 months ago
I think the answer is C. Comparing strings directly can be tricky in Solidity, so hashing them and comparing the hashes is a good approach.
upvoted 0 times
Francisca
25 days ago
Definitely C, better for security and accuracy.
upvoted 0 times
...
Davida
30 days ago
I like option C as well, avoids pitfalls.
upvoted 0 times
...
Ronald
1 month ago
Direct comparison can lead to issues, hashing is the way!
upvoted 0 times
...
Jaime
1 month ago
I agree, hashing is safer for string comparison.
upvoted 0 times
...
Viola
5 months ago
C makes the most sense to me too.
upvoted 0 times
...
...

Save Cancel