Accenture Primer
Accenture DumpmediumAccenture PrimerAccenture-Primer-Dump

Accenture Accenture Primer Practice Question

Predict the output What will be the output for the given code snippet Startprogram Import java.util.regex; Public class Main{ public static void main(String args[]) { String s=”ABC”; Pattern p=Pattern.compile(s); String r=”ABCABCABCABC”; Matcher m=p.matcher(r); System.out.println(m.lookingAt()); } } endprogram

Answer options

A
true
B
false
C
ABC
D
0

Correct answer: true

Explanation

Matcher.lookingAt() attempts to match the pattern at the beginning of the input. The pattern 'ABC' matches the start of 'ABCABCABCABC', so it returns true.

Related Accenture Accenture Primer questions

Practice more Accenture Accenture Primer questions

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.