Free ServiceNow CAD Actual Exam Questions - Question 14 Discussion
g_user.hasRole(,x_my_app_user');
Option C since the syntax is clearly wrong, so the method might not actually exist.
This one’s definitely D. The hasRole method strictly checks for the given role, and it won’t return true just because the user has some other role like admin. The syntax looks a bit funky but that doesn’t change how hasRole behaves—it’s role-specific. A is out because admin isn’t included implicitly, and C is incorrect since hasRole is a valid method. B is the opposite of what hasRole does, so no chance there.
It’s D because hasRole is role-specific and doesn’t consider admin as a default true. A is wrong since it includes admin, which isn’t how hasRole works. The syntax weirdness doesn’t change that.
D. The method specifically checks for the role passed, so it won’t return true for other roles like admin. The syntax looks a bit off but the gist is that hasRole only confirms that particular role.
It’s D for sure. The hasRole method checks if the user has that specific role, so it won’t return true just because the user is admin or something else. Also, the method definitely exists, so C is out. B sounds off because it talks about returning false only if the user has the role, which doesn’t make sense. A includes admin role too, which isn’t part of the check here. So D fits perfectly.
D (looks straightforward, true only for that role)