New Year Sale 2026! 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
12 days ago
I disagree, A should work in some cases too!
upvoted 0 times
...
Emogene
17 days ago
Wait, you can't compare strings directly? That's surprising!
upvoted 0 times
...
Dana
22 days ago
D is actually a common workaround, but not always reliable.
upvoted 0 times
...
Ashanti
27 days ago
I thought you could just use A? Seems easier.
upvoted 0 times
...
Julianna
1 month ago
C is the way to go, hashing is the best method!
upvoted 0 times
...
Shonda
1 month ago
Hashing strings? What is this, the 1980s? Real developers use the Force to compare strings.
upvoted 0 times
...
Rasheeda
1 month 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
2 months ago
D) is interesting, but it's not the best solution. Hashing the strings is more reliable.
upvoted 0 times
...
Daniel
2 months ago
A) is just plain wrong. You can't compare strings like that in Solidity.
upvoted 0 times
...
Thea
2 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
2 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
2 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
2 months ago
C makes sense. Hashing avoids issues with string encoding.
upvoted 0 times
...
Mable
3 months ago
I prefer D. Converting to bytes32 seems straightforward.
upvoted 0 times
...
Daniel
3 months ago
I think it's C. Hashing is the way to go.
upvoted 0 times
...
Sanjuana
3 months ago
A is wrong, right? Direct comparison doesn't work.
upvoted 0 times
...
Viva
3 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
4 months ago
I think you can't directly compare strings in Solidity, so maybe it's C? That sounds familiar.
upvoted 0 times
...
Laticia
4 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
4 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
4 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
4 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
Viola
3 months ago
C makes the most sense to me too.
upvoted 0 times
...
...

Save Cancel