
Data Manipulation Quiz

Quiz
•
Computers
•
11th Grade
•
Hard
David Coetzer
Used 1+ times
FREE Resource
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A programmer is displaying records from a tblProducts table one at a time on a form. After displaying the first product, they want to show the next one. Which command is used to move the dataset's cursor to the very next record in the table?
tblProducts.First;
tblProducts.Next;
tblProducts.Last;
tblProducts.Bookmark;
Answer explanation
The command tblProducts.Next; is used to move the dataset's cursor to the next record in the tblProducts table. The other options do not serve this purpose.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
You have a table tblSales with fields Quantity and Price. You need to display the total cost for each sale (Quantity * Price) in a TDBGrid, but you don't want to add a permanent 'TotalCost' field to the actual database table. How can you achieve this?
Manually calculate the total for each row and add it to the TDBGrid cells.
Create a calculated field in the dataset component that computes the total on-the-fly.
Use the tblSales.Insert; command to add a new column to the table temporarily.
Write a separate SQL query just to calculate the totals and display it in another grid.
Answer explanation
Creating a calculated field in the dataset allows for dynamic computation of TotalCost (Quantity * Price) without altering the database structure, making it the most efficient solution for displaying totals in the TDBGrid.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In an application for a veterinarian, you need to calculate the total amount billed for a specific animal's treatments. The tblInvoices contains VisitDate, AnimalID, and Amount. What is the most efficient way to sum the Amount for only the records where AnimalID is 'A101'?
Loop through the entire tblInvoices table with .First and .Next, and use an if statement inside the loop to check if AnimalID is 'A101' before adding the Amount to a running total.
Use the .Locate method to find the first record for 'A101' and then only read the Amount from that single record.
Filter the dataset using tblInvoices.Filter := 'AnimalID = ''A101'''; tblInvoices.Filtered := True; and then loop through the much smaller, filtered result set to sum the Amount.
Ask the user to manually select all the correct records in the TDBGrid and then click a 'Calculate Total' button.
Answer explanation
Filtering the dataset for 'A101' reduces the number of records to process, making it more efficient to sum the Amount. This method avoids unnecessary checks on unrelated records, unlike looping through the entire table.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
An administrator at a school needs to find all students in tblStudents who are registered in 'Grade 11'. Which line of code correctly sets the filter for the dataset?
tblStudents.Filter := 'Grade = 11';
tblStudents.Filter := 'Grade = ''11''';
tblStudents.Filter := 'Grade: 11';
tblStudents.Filtered := 'Grade = 11';
Answer explanation
The correct filter syntax requires single quotes to denote string values in SQL-like queries. Thus, 'Grade = ''11'';' correctly filters for students in Grade 11, while the other options are either incorrect or improperly formatted.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A real estate application needs to display a list of available properties in a TDBGrid. The tblProperties table has a Status field. Which two properties of the dataset component must be used together to show only the properties where the Status is 'Available'?
.Filter and .Filtered
.Filter and .Active
.Locate and .Filtered
.IndexName and .MasterSource
Answer explanation
.Filter allows you to specify a condition (e.g., Status = 'Available'), while .Filtered must be set to true to apply that filter. Together, they effectively limit the dataset to show only the desired properties.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A sales manager wants to see all sales from the last quarter that were greater than R5000. The tblSales table has a SaleDate (a TDateTime field) and a SaleAmount (a numeric field). Which filter expression would achieve this?
tblSales.Filter := 'SaleDate >= #01/05/2025# AND SaleAmount > 5000';
tblSales.Filter := 'SaleDate > 01-05-2025 AND SaleAmount > 5000';
tblSales.Filter := 'SaleDate is after #01/05/2025# AND SaleAmount >= 5000';
tblSales.Filter := 'SaleAmount > 5000 OR SaleDate >= #01/05/2025#';
Answer explanation
The correct filter expression is 'SaleDate >= #01/05/2025# AND SaleAmount > 5000' as it accurately captures sales from the last quarter (starting from 01/05/2025) that exceed R5000.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A data clerk is cleaning a tblMembers database. They need to find members who have not provided an email address. The Email field for these members is empty. What is the correct way to check if the Email field for the current record is empty?
if tblMembers['Email'] = '' then...
if tblMembers['Email'].IsEmpty then...
if tblMembers.FieldByName('Email').IsNull then...
if tblMembers['Email'] = NULL then...
Answer explanation
The correct choice is 'if tblMembers.FieldByName('Email').IsNull then...'. This checks if the Email field is null, which indicates that no email address has been provided, unlike the other options that are incorrect.
Create a free account and access millions of resources
Similar Resources on Wayground
13 questions
Computer Science Principles

Quiz
•
10th - 12th Grade
15 questions
Advanced HTML and CSS

Quiz
•
9th - 12th Grade
15 questions
BTEC L2 Unit 1 Online World 1-8

Quiz
•
11th - 12th Grade
11 questions
Latihan Soal HTML

Quiz
•
9th - 12th Grade
10 questions
Electrical Circuit II 2

Quiz
•
KG - University
17 questions
SQL2

Quiz
•
11th Grade
10 questions
Perintah Join SQL

Quiz
•
11th Grade - University
9 questions
Aloft Air Control Training Video 6

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade