WorksheetsGrade 11 IT PAT Quiz
Total questions: 15
Worksheet time: 8mins
In the context of PAT Task 8 (Coding), which Delphi code snippet best translates the following algorithm: 'Check if a learner's mark is 50 or more. If it is, display 'Pass'; otherwise, display 'Fail'.
if iMark >= 50 then ShowMessage('Pass') else ShowMessage('Fail');
if iMark > 50 then ShowMessage('Pass');
case iMark of 50..100: ShowMessage('Pass'); else ShowMessage('Fail'); end;
while iMark >= 50 do ShowMessage('Pass');
When implementing data validation as per PAT requirements, what is the primary purpose of the TryStrToInt function in Delphi?
To convert a string to an integer and halt the program if the string is not a valid number.
To test if a string contains a valid integer and return True or False, without performing the conversion.
To safely attempt to convert a string to an integer, returning a boolean to indicate success and preventing a runtime error if the input is non-numeric.
To format an integer as a string with specific currency formatting.
For your PAT, you need to store the names of 10 clients. Which is the most appropriate data structure and declaration in Delphi?
A dynamic array: arrClients: array of String;
A static array: arrClients: array[1..10] of String;
A single variable: sClients: String;
A two-dimensional array: arrClients: array[1..1, 1..10] of String;
Which of the following demonstrates a user-friendly GUI design principle that should be applied in a PAT project?
Using red text on a blue background for all labels to make them stand out.
Placing all input components (TEdits, TComboBoxes) randomly on the form to save space.
Grouping related controls, like client details, together within a TGroupBox or TPanel.
Requiring the user to type dates in a TEdit without providing a TDateTimePicker.
In a multi-form Delphi application for a PAT, what is a common and effective technique for passing data from a main form (frmMain) to a secondary form (frmDetails)?
Storing the data in global variables.
Creating a public method or property on the secondary form (frmDetails) that the main form can call to set the required data before showing it.
Saving the data to a text file from frmMain and then immediately reading it in frmDetails.
Making all components on frmDetails public so frmMain can directly access them.
Which SQL statement is used to retrieve all columns for every client from a table named tblClients?
SELECT * FROM tblClients;
GET * FROM tblClients;
SELECT ALL FROM tblClients;
READ * FROM tblClients;
During PAT Task 9 (Testing), you run your program and it crashes with an 'Access Violation' error when you click a button. What type of error is this?
Syntax Error
Logic Error
Runtime Error
Compilation Error
What is the purpose of creating test cases with both valid and invalid data for PAT Task 9?
To prove that the program works perfectly under all possible conditions.
To check how the program responds to expected input and to ensure it handles unexpected or incorrect input gracefully without crashing.
To meet the minimum number of tests required by the PAT rubric.
To test only the GUI components and not the underlying data processing logic.
To write a list of client names stored in an array arrClients to a text file named 'clients.txt', which Delphi code snippet is most appropriate?
AssignFile(fFile, 'clients.txt'); Rewrite(fFile); for k := 1 to 10 do Writeln(fFile, arrClients[k]); CloseFile(fFile);
LoadFromFile('clients.txt');
AssignFile(fFile, 'clients.txt'); Reset(fFile); for k := 1 to 10 do Readln(fFile, arrClients[k]); CloseFile(fFile);
SaveToFile('clients.txt');
In your PAT, you have a TTabControl. How do you programmatically switch the visible tab from the first tab (index 0) to the second tab (index 1)?
TabControl1.Visible[1] := True;
TabControl1.TabIndex := 1;
TabControl1.Tabs[1].Show;
TabControl1.Change(1);
Which of the following is an example of effective error handling in a PAT project?
Letting the program crash when a user enters text instead of a number, then telling the user to restart it.
Using a ShowMessage to display 'Error!' without any further information about what went wrong.
Wrapping database connection code in a try...except block to catch potential connection failures and inform the user.
Ignoring all potential user input errors because the user should know how to use the program correctly.
You need to modify an existing client's phone number in your database. If the client's ID is 5, which SQL statement is most appropriate?
INSERT INTO tblClients (PhoneNumber) VALUES ('0821234567') WHERE ClientID = 5;
MODIFY tblClients SET PhoneNumber = '0821234567' WHERE ClientID = 5;
DELETE FROM tblClients WHERE ClientID = 5;
UPDATE tblClients SET PhoneNumber = '0821234567' WHERE ClientID = 5;
What is the primary role of a debugger tool during the coding and testing phase of the PAT?
To automatically find and fix all logic errors in the code.
To allow the programmer to pause execution, step through code line-by-line, and inspect the values of variables at runtime.
To write the test plan and document the testing process.
To improve the visual design and layout of the GUI.
A user-defined function in Delphi must always have...
At least one input parameter.
A return type.
Code that interacts with a database.
A call to ShowMessage.
When designing your PAT's database, using a unique, auto-incrementing integer as a Primary Key (e.g., 'ClientID') is a good practice because...
It is required by the Delphi IDE to connect to the table.
It ensures every record can be uniquely identified, even if other details (like names) are identical, which is crucial for reliable updates and deletions.
It makes the database smaller in file size.
It automatically sorts the table by client name.
