Which statement is true? 1. Both p and s are accessible by obj. 2. only s is accessible by obj. 3. Both r and s are accessible by obj. 4. p, r, and s are accessible by obj.
Correct Answer : 2 Explanation:
p is not public in p1.Acc; cannot be accessed from outside package r has protected access in p1.Acc
Question : You are developing a banking module. You have developed a class named ccMask that has a maskcc method.
Given the code fragment as shown in image: 1. A,B 2. B,C 3. C,D 4. A,D
Correct Answer : 2
Explanation: option A : In this we are doing substring for StringBuilder instance, however not using returned string. Hence, result will be mask string + entire credit card number. option B : We are concatenation mask string and last 4 digists. Hence, will return correct result. option C : We have used append method of StringBuilder class to append mask string and last 4 digits. It will work perfectly. option D : It will append both entire mask string and full credit card number. (Hence, not a correct solution)
Correct Answer : 4 Explanation: First print statement will print the size of array, which is 4 and second print statement will print size of second element in array which is "Venus" which is 5