CAD
Free CAD practice questions
10 questions from our CAD practice tests, each with the correct answer and a written explanation. Read them with the answers shown, or switch to quiz mode and answer first.
Question 1 of 10, Designing and Creating an Application
A developer is creating the Trip table and wants each new record to receive an automatically generated identifier such as TRP0001001. Which option should be configured when creating the table?
- AA default value of TRP on the Name field with the field set to unique
- BA before business rule that sets the Number field to the row count
- CAuto-number, with a prefix of TRP and the desired number of digits Correct answer
- DA calculated field that concatenates TRP with the record's sys_id
Answer and explanation: The table's auto-number setting creates a Number field and a number maintenance record with a prefix and digit count, generating unique sequential identifiers. A static default value is the same for every record, and concatenating a sys_id yields a 32-character string rather than a readable sequence. Using the row count in a business rule produces duplicates after deletions and is not concurrency-safe.
Question 2 of 10, Designing and Creating an Application
A team must decide whether a new Contractor Onboarding application should extend Task or create a standalone table. Onboarding records need assignment, work notes and SLAs, and contractors also appear as users. Which design is BEST?
- ACreate a standalone onboarding table and copy the contractor's user details into text fields
- BExtend Task for the onboarding record and reference sys_user for the contractor Correct answer
- CExtend sys_user for the onboarding record so each contractor and task are the same record
- DExtend the Requested Item table so each onboarding record becomes a catalog fulfilment item
Answer and explanation: Onboarding is work to be done, so extending Task brings assignment, work notes and SLA support, while referencing sys_user links the contractor without duplicating data. Extending sys_user mixes people records with work records. A standalone table loses task features and copying user data creates duplicates. Requested Item belongs to the catalog fulfilment model and brings unrelated request semantics.
Question 3 of 10, Application User Interface
A developer wants to hide the Cost center field on the Asset Request form whenever State is Closed. The rule should work on forms without writing any code and should reverse itself when State changes back. What is the BEST approach?
- ACreate a UI policy with the condition State is Closed, a UI policy action that sets Visible to false, and Reverse if false selected Correct answer
- BCreate a data policy with the condition State is Closed that sets the Cost center field to read-only on import and web service updates
- CCreate a write ACL on the Cost center field with the condition State is Closed so that the field is no longer visible
- DCreate an onLoad client script that uses g_form.setDisplay to hide the field when the form first opens in a Closed state
Answer and explanation: UI policies are the no-code way to change field visibility, mandatory and read-only state on forms, and Reverse if false undoes the actions when the condition no longer matches. Data policies enforce mandatory and read-only rules on data, not visibility. A write ACL controls editing rather than hiding, and an onLoad client script would not react to later changes to State and requires code.
Question 4 of 10, Application User Interface
Which client-side code correctly calls a client-callable script include named LoanUtils, method getRisk, and passes the loan sys_id?
- Avar ga = new GlideAjax('LoanUtils'); ga.addParam('sysparm_method', 'getRisk'); ga.addParam('sysparm_loan', g_form.getUniqueValue()); ga.getXMLAnswer(function(answer) { g_form.setValue('risk', answer); });
- Bvar ga = new GlideAjax('getRisk'); ga.addParam('sysparm_name', 'LoanUtils'); ga.addParam('sysparm_loan', g_form.getUniqueValue()); ga.getXMLAnswer(function(answer) { g_form.setValue('risk', answer); });
- Cvar ga = new LoanUtils(); ga.addParam('sysparm_name', 'getRisk'); ga.addParam('sysparm_loan', g_form.getUniqueValue()); var answer = ga.getRisk(); g_form.setValue('risk', answer);
- Dvar ga = new GlideAjax('LoanUtils'); ga.addParam('sysparm_name', 'getRisk'); ga.addParam('sysparm_loan', g_form.getUniqueValue()); ga.getXMLAnswer(function(answer) { g_form.setValue('risk', answer); }); Correct answer
Answer and explanation: GlideAjax is constructed with the script include name, sysparm_name selects the method, and getXMLAnswer runs the callback asynchronously with the returned value. The method must be passed as sysparm_name, not sysparm_method. Swapping the class and method names calls a non-existent script include, and server-side script include classes cannot be instantiated directly in the browser.
Question 5 of 10, Security and Restricting Access
A script in application A calls a script include in application B. The script include is accessible from all application scopes, but Runtime Access Tracking for application A is set to Enforcing and no cross-scope privilege exists. What happens when the call runs?
- AThe call fails only for users without admin, because admins bypass cross-scope privilege checks
- BThe call succeeds and a cross-scope privilege record is created automatically with Status set to Allowed
- CThe call is blocked and a request for the cross-scope privilege is logged so an admin can review it Correct answer
- DThe call succeeds because Accessible from all application scopes overrides Runtime Access Tracking
Answer and explanation: With Enforcing, cross-scope calls require an explicitly allowed cross-scope privilege; otherwise they fail and a requested privilege record is created for review. Automatic allowance happens in Tracking mode, not Enforcing. Accessible from all scopes makes the target eligible but does not override the caller's enforcement setting, and admin users do not bypass this check.
Question 6 of 10, Security and Restricting Access
The Loan table must be readable by users with the x_acme_loan.user role, but only users with x_acme_loan.manager can see the Interest rate field. Which ACL configuration achieves this?
- AA UI policy that hides Interest rate for non-managers, and a read ACL on x_acme_loan.none requiring the user role
- BA read ACL on x_acme_loan.* requiring the manager role, and a read ACL on x_acme_loan.none requiring the user role and the manager role
- CA read ACL on x_acme_loan.none requiring the user role, and a read ACL on x_acme_loan.interest_rate requiring the manager role Correct answer
- DA read ACL on x_acme_loan.interest_rate requiring the user role, and a write ACL on x_acme_loan.none requiring the manager role
Answer and explanation: A table-level read ACL grants row access to users, and a more specific field-level read ACL on interest_rate restricts that one field to managers. A wildcard field ACL requiring managers would hide every field from regular users, and requiring both roles at table level blocks normal users entirely. A write ACL does not restrict reading, and a UI policy only hides the field on the form while the data stays accessible through lists and APIs.
Question 7 of 10, Application Automation
Which server-side script correctly retrieves all active Loan records assigned to the current user and logs each number?
- Avar gr = new GlideRecord('x_acme_loan'); gr.addQuery('active', true); gr.addQuery('assigned_to', gs.getUserID()); while (gr.next()) { gs.info(gr.number); } gr.query();
- Bvar gr = new GlideRecord('x_acme_loan'); gr.get('active', true); gr.addQuery('assigned_to', gs.getUserName()); gr.query(); if (gr.next()) { gs.info(gr.number); }
- Cvar gr = new GlideRecord('x_acme_loan'); gr.addQuery('active', true); gr.addQuery('assigned_to', g_user.userID); gr.query(); while (gr.next()) { gs.info(gr.number); }
- Dvar gr = new GlideRecord('x_acme_loan'); gr.addQuery('active', true); gr.addQuery('assigned_to', gs.getUserID()); gr.query(); while (gr.next()) { gs.info(gr.number); } Correct answer
Answer and explanation: The correct pattern adds conditions, calls query(), then iterates with while (gr.next()); assigned_to stores a sys_id, so gs.getUserID() is the right comparison. Calling query() after the loop means no results are iterated. get() with if (next) returns at most one record and gs.getUserName() returns the user name, not the sys_id. g_user is a client-side object and is not available in server scripts.
Question 8 of 10, Application Automation
A notification must be sent when a loan becomes overdue, which is detected by a nightly scheduled script. The developer wants the email logic decoupled from the script. Which approach is recommended?
- ARegister an event, call gs.eventQueue() from the scheduled script, and configure the notification to send when the event is fired Correct answer
- BConfigure the notification to send when a record is updated and let the scheduled script call current.update() on each loan
- CCreate an after business rule on the loan table that runs nightly and builds the email using template.print()
- DBuild the email inside the scheduled script with a GlideRecord insert on sys_email for every overdue loan record
Answer and explanation: Firing a registered event with gs.eventQueue and triggering the notification on that event cleanly separates detection from messaging. Forcing record updates only to trigger an update notification creates extra audit entries and side effects. Inserting directly into sys_email bypasses the notification framework, and business rules do not run on a nightly schedule.
Question 9 of 10, Working with External Data
A nightly import of employees must update existing users instead of creating duplicates. Each source row contains an employee number that matches the Employee number field on sys_user. What should the developer configure?
- ASet Coalesce to true on the field map for the employee number field Correct answer
- BEnable Run business rules on the transform map
- CAdd an onAfter transform script that finds and deletes the older duplicate users
- DSet Coalesce to true on every field map in the transform
Answer and explanation: Coalescing on a unique identifier tells the transform to update the matching target record when a value matches and insert only when none does. Coalescing on every field would require all values to match, creating new records whenever any attribute changed. Running business rules does not affect matching, and deleting duplicates after insertion is wasteful and risks data loss.
Question 10 of 10, Managing Applications
Before releasing an application, the team wants to automatically detect issues such as GlideRecord queries inside loops and hard-coded sys_ids. Which platform feature can scan the application against configurable checks?
- AField Watcher
- BSession debugger
- CUpdate set preview
- DInstance Scan Correct answer
Answer and explanation: Instance Scan runs configurable checks against instance configuration and application files to find best-practice issues. The Field Watcher traces field changes on a form, update set preview detects collisions during migrations, and session debugging logs runtime activity rather than scanning code.