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

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 1z0-808 topic 1 question 42 discussion

Actual exam question from Oracle's 1z0-808
Question #: 42
Topic #: 1
[All 1z0-808 Questions]

You are developing a banking module. You have developed a class named ccMask that has a maskcc method.
Given the code fragment:

You must ensure that the maskcc method returns a string that hides all digits of the credit card number except the four last digits (and the hyphens that separate each group of four digits).
Which two code fragments should you use at line n1, independently, to achieve this requirement? (Choose two.)

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Show Suggested Answer Hide Answer
Suggested Answer: BC 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
iSnover
Highly Voted 1 year, 9 months ago
Correct is B and C, because: - A is Wrong, will print "XXXX-XXXX-XXXX-1234-5678-9101-1121" because String is immutable and in the line 2 of the Anwser is an code isolated, not chance the "sb" variable - B is Correct, you can acess the value of the method substring with the parrametrs direclty - C is Correct, with the method "append" of StringBuilder in the line 2 of the Answer, you can concatenate with an String and can choose the range of String that you want concatenate - D is Wrong, because de range is incorrect
upvoted 5 times
...
Kolodets
Most Recent 1 year, 2 months ago
insert(int Index, String) method of StringBuilder replaces only the given index => D wrong
upvoted 1 times
...
odzio33
1 year, 5 months ago
Selected Answer: BC
public class Main2 { public static String maskCC(String creditCard){ String x = "XXXX-XXXX-XXXX-"; return x + creditCard.substring(15,19); } public static String maskCC2(String creditCard){ String x = "XXXX-XXXX-XXXX-"; StringBuilder sb = new StringBuilder(x); sb.append(creditCard, 15, 19); return sb.toString(); } public static void main(String[] args) { System.out.println(maskCC("1234-5678-9101-1121")); System.out.println(maskCC2("1234-5678-9101-1121")); } }
upvoted 1 times
...
TOPPSI
1 year, 5 months ago
Selected Answer: BC
Correct Anwser BC. Tested
upvoted 1 times
...
kkaayyyy
1 year, 8 months ago
B and C is the correct answer
upvoted 1 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 ...
ex Want to SAVE BIG on Certification Exam Prep?
close
ex Unlock All Exams with ExamTopics Pro 75% Off
  • arrow Choose From 1000+ Exams
  • arrow Access to 10 Exams per Month
  • arrow PDF Format Available
  • arrow Inline Discussions
  • arrow No Captcha/Robot Checks
Limited Time Offer
Ends in