Font size
Worksheetsuser-defined
Total questions: 81
Worksheet time: 33mins
What is a user-defined data type?
A data type that references other data types
A primitive data type built into the programming language
A data type created by the programmer based on existing types
A data type that only stores numeric values
Which of the following is an example of a non-composite data type?
Record
Set
Enumerated data type
Class
What is the purpose of a pointer data type?
To store characters in memory
To reference a memory location
To define a list of unordered elements
To represent a composite data type
How is an enumerated data type defined in pseudocode?
TYPE TDays = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)
ENUM TDays AS [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
TYPE ENUM TDays = Monday TO Sunday
SET TDays = {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}
What distinguishes a composite data type from a non-composite one?
Composite data types refer to other data types in their definition.
Non-composite data types store multiple values.
Composite data types are built into programming languages.
Non-composite data types are not used for special purposes.
What is a hashing algorithm used for in file access?
To store files in alphabetical order
To encrypt data in a file
To calculate the address of a record in a file
To merge two sequential files
Which file organization method is most efficient for temporary files?
Random
Sequential
Serial
Indexed
What is the key characteristic of a sequential file organization?
Records are stored based on a hashing algorithm.
Records are stored in the order of arrival.
Records are stored in ascending order of the key field.
Records are stored in alphabetical order.
What is an example of an enumerated data type?
A list of customer names
A collection of unique memory addresses
A list of the months in a year
A table of records with different fields
What does an open hash do when a collision occurs?
Deletes the previous record
Moves the record to an overflow area
Stores the record in the next available space
Uses a different hashing algorithm
What is the role of the key field in file organization?
It determines the physical storage order of records.
It represents the total size of a record.
It provides encryption for secure data.
It defines the file structure format.
How does sequential access operate in a file?
Records are accessed based on their memory address.
Records are read one after another until the required record is found.
Records are searched using an index.
Records are accessed in any order using a hashing algorithm.
What is the result of using a hashing algorithm on a key field?
A sequence of all records in ascending order
The location where the record should be stored or accessed
An encrypted version of the key field
The total number of records in a file
Which of the following is an advantage of random file organization?
It is the most straightforward method for appending records.
It guarantees collision-free storage.
Records can be accessed directly without searching sequentially.
Records are always stored in ascending order.
How does a closed hash handle collisions?
Deletes the conflicting record
Stores the record in an overflow area
Replaces the old record with the new one
Changes the hashing algorithm
What does the term 'key field' refer to?
A special identifier used to determine the order of records
A pointer to another record in the file
A reserved space in the file header
A unique field used to encrypt file contents
What is the primary use of serial file organization?
For files that require quick random access
For storing temporary transaction data
For files requiring frequent updates
For encrypted data storage
In what order are records stored in sequential file organization?
By arrival time
By key field values
By memory address
By file creation time
Why is a hashing algorithm necessary in random file organization?
To sort the records in ascending order
To encrypt the records before storing them
To calculate storage locations for records
To avoid the need for direct access
What is a collision in hashing?
When two records are assigned the same memory location
When the hashing algorithm fails
When a record cannot be located
When a file exceeds its allocated size
What does the term 'hit rate' refer to in file access?
The percentage of records found directly during sequential access
The number of records accessed in one operation
The frequency with which a file is updated
The percentage of records processed during file access
Which of the following best describes a pointer?
A variable storing a memory address
A data type that stores numeric values
A collection of unique elements
A file storage mechanism
What is the main disadvantage of sequential access?
Records cannot be appended to the file.
The entire file must be read to access a specific record.
It requires an index to locate records.
It uses a lot of memory.
Which data type is most appropriate for storing the days of the week?
Set
Record
Enumerated data type
Pointer
What happens if two key fields produce the same address using a hashing algorithm?
The record is overwritten.
A collision occurs.
The file is re-indexed.
The hashing algorithm is recalculated.
Which of these is a composite data type?
Record
Enumerated data type
Pointer
Key field
What is a key advantage of using direct access in file organization?
Records can be processed in the order of arrival.
Records can be accessed quickly without reading other records.
Records are always sorted by the key field.
Records are encrypted before storage.
Which data type would you use for storing a unique set of memory addresses?
Pointer
Enumerated
Composite
Serial
In file organization, what is a 'serial file'?
A file where records are accessed directly.
A file where records are stored in the order they are added.
A file with an index for faster access.
A file that uses a hashing algorithm to locate records.
What is the purpose of an overflow area in hashing?
To store large files that exceed the allocated space
To store records that cannot be placed in their hashed location
To backup the entire file
To reorganize the file for better performance
Which of the following is a composite data type?
Class
Enumerated
Pointer
Integer
Which file organization method requires the use of a hashing algorithm?
Sequential
Random
Serial
Indexed
What is the role of the key field in hashing?
It uniquely identifies each record in the file.
It serves as a pointer to a memory location.
It encrypts data for secure storage.
It organizes records in alphabetical order.
What is a disadvantage of using random file organization?
Records cannot be accessed directly.
It requires a large amount of memory.
Collisions can occur, requiring additional handling.
Records must be stored sequentially.
What is the primary use of an enumerated data type?
To store large sets of records
To define a list of all possible values with an implied order
To access records directly using a key field
To store the memory address of another data type
What method does sequential access use to find a record?
Searching from the beginning of the file one record at a time
Using a hashing algorithm to calculate the location
Referencing a memory address stored in a pointer
Using an overflow area for unmatched records
Which of these describes a set data type?
It stores records with a unique key field.
It is a composite data type that includes other data types.
It stores unordered elements with set operations like union and intersection.
It defines an ordered list of possible values.
Which of the following is an example of a user-defined composite data type?
Enumerated data type
Pointer
Record
Integer
What happens when a hashing collision occurs in an open hash system?
The record is deleted.
The record is stored in the next free space.
The hashing algorithm is recalculated.
The record is stored in an overflow area.
48. How is data accessed in a sequential file using direct access?
A) Using a pointer to directly locate the record
B) Using an index to find the location of the record
C) Searching the file record by record until the key field matches
D) Using a hashing algorithm to calculate the address
49. Why are hashing algorithms important for random file organization?
A) They store records in ascending order.
B) They provide encryption for file data.
C) They calculate record locations efficiently.
D) They eliminate collisions.
50. Which composite data type includes methods and variables?
A) Set
B) Record
C) Class
D) Pointer
51. What is the primary impact of increasing the size of the mantissa in a floating-point number representation?
a) Increased range of representable numbers
b) Improved precision in representing numbers
c) Faster arithmetic operations
d) Reduced memory usage
A larger exponent in a floating-point number format primarily affects which aspect of the representation?
a) The precision of the number
b) The range of representable numbers
c) The speed of calculations
d) The storage size of the number
53. How does a larger mantissa influence the representation of very small numbers?
a) It allows for more precise representation of very small numbers
b) It limits the representation of very small numbers
c) It has no significant impact on the representation of very small numbers
d) It increases the range of representable very small numbers
54. In scientific notation, a larger exponent corresponds to a number that is:
a) Smaller in magnitude
b) Larger in magnitude
c) More precise
d) Less precise
55. Which of the following scenarios would benefit the most from increasing the size of the mantissa in a floating-point representation?
a) Representing very large integers
b) Performing integer arithmetic operations
c) Representing very small fractions
d) Storing text data
Why are user-defined data types necessary in programming?
They allow programmers to create structured and meaningful representations of data.
They replace built-in data types entirely.
They reduce the need for variables in a program.
They prevent the use of arrays.
Which of the following is a non-composite user-defined data type?
Enumerated type
Array
Record
Class
What is the purpose of an enumerated type?
It defines a variable that can hold a predefined set of values.
It allows variables to store floating-point numbers.
It dynamically allocates memory for objects.
It creates a class for object-oriented programming.
Which of the following is a valid enumerated type declaration in pseudocode?
TYPE Day = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)
ENUM Day = Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
DECLARE Day AS ENUM(Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)
SET Day = Monday OR Tuesday OR Wednesday OR Thursday OR Friday OR Saturday OR Sunday
What is a pointer used for in programming?
It stores the memory address of another variable.
It stores multiple values of different types.
It creates an enumerated list of values.
It defines a user-defined function.
Which of the following statements about pointers is true?
A pointer holds the memory address of a variable.
A pointer is a composite data type.
A pointer always points to a constant value.
Pointers cannot be dereferenced.
Which of the following is a composite data type?
Record
Enumerated type
Pointer
Boolean
Which of the following is a correct definition of a record in pseudocode?
TYPE StudentRecord DECLARE Name : STRING DECLARE Age : INTEGER DECLARE Grade : CHAR END TYPE
RECORD StudentRecord Name : STRING Age : INTEGER Grade : CHAR END RECORD
TYPE StudentRecord(Name STRING, Age INTEGER, Grade CHAR)
SET StudentRecord = (Name, Age, Grade)
Which composite data type represents a collection of unique elements?
Set
Array
Pointer
Record
Which of the following statements is true about sets?
A set contains only unique values and does not allow duplicates.
A set can contain duplicate values.
A set is the same as an array.
A set can store elements of different data types in a single set.
Why are user-defined data types necessary in programming?
They allow programmers to create structured and meaningful representations of data.
They replace built-in data types entirely.
They reduce the need for variables in a program.
They prevent the use of arrays.
Which of the following is NOT a benefit of user-defined data types?
They make debugging impossible.
They improve code readability and maintainability.
They allow for data abstraction and encapsulation.
They help organize complex data structures.
Which of the following is a non-composite user-defined data type?
Enumerated type
Array
Record
Class
What is the purpose of an enumerated type?
It defines a variable that can hold a predefined set of values.
It allows variables to store floating-point numbers.
It dynamically allocates memory for objects.
It creates a class for object-oriented programming.
What is a pointer used for in programming?
It stores the memory address of another variable.
It stores multiple values of different types.
It creates an enumerated list of values.
It defines a user-defined function.
Which of the following statements about pointers is true?
A pointer holds the memory address of a variable.
A pointer is a composite data type.
A pointer always points to a constant value.
Pointers cannot be dereferenced.
Which of the following is a composite data type?
Record
Enumerated type
Pointer
Boolean
What is a record used for?
To store a collection of different data types under one identifier.
To store a single data type in a fixed-size array.
To reference another variable’s memory address.
To create a collection of similar values.
Which of the following is a correct definition of a record in pseudocode?
TYPE StudentRecord DECLARE Name : STRING DECLARE Age : INTEGER DECLARE Grade : CHAR END TYPE
RECORD StudentRecord Name : STRING Age : INTEGER Grade : CHAR END RECORD
TYPE StudentRecord(Name STRING, Age INTEGER, Grade CHAR)
SET StudentRecord = (Name, Age, Grade)
Which of the following is a characteristic of a class?
It defines both data (attributes) and behavior (methods).
It is only used for enumerations.
It is a simple variable type with no functions.
It cannot contain multiple data types.
Which composite data type represents a collection of unique elements?
Set
Array
Pointer
Record
Which of the following statements is true about sets?
A set contains only unique values and does not allow duplicates.
A set can contain duplicate values.
A set is the same as an array.
A set can store elements of different data types in a single set.
Which user-defined type would be best suited to store the days of the week?
Enumerated type
Record
Pointer
Set
If a program needs to store detailed information about a student (name, age, and grade), which data type should be used?
Record
Pointer
Enumerated type
Boolean
Which of the following scenarios would be best suited for a pointer?
When managing dynamic memory allocation in a program.
When storing predefined constant values.
When defining a list of allowed colors in an application.
When creating a database of employee records.
Which of the following is the best user-defined type to represent a shape with properties like width, height, and color?
Class
Set
Pointer
Enumerated type
Why is choosing the right user-defined data type important?
It ensures efficiency, readability, and maintainability of the program.
It makes the code unnecessarily complex.
It prevents the use of built-in data types.
It allows data to be stored in only one format.
How could we declare a variable called Book using this data type?
DECLARE LibraryBookRecord TYPE Book
DECLARE Book : TYPE LibraryBookRecord
DECLARE Book : LibraryBookRecord
DECLARE LibraryBookRecord : Book
What pseudocode should be included here to define a set type?
TYPE <set-identifier> (a) <Basetype>
Which of these is the correct way to declare an enumerated data type that will consist of the three sports in a modern triathlon
DECLARE Ttriathlon = (swimming, cycling, running,)
DECLARE Ttriathlon = ("swimming", "cycling", "running")
TYPE Ttriathlon = (swimming, cycling, running,)
TYPE Ttriathlon = ("swimming", "cycling", "running")
