wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

user-defined

Total questions: 81

Worksheet time: 33mins

Name
Class
Date
1.

What is a user-defined data type?

a)

A data type that references other data types

b)

A primitive data type built into the programming language

c)

A data type created by the programmer based on existing types

d)

A data type that only stores numeric values

2.

Which of the following is an example of a non-composite data type?

a)

Record

b)

Set

c)

Enumerated data type

d)

Class

3.

What is the purpose of a pointer data type?

a)

To store characters in memory

b)

To reference a memory location

c)

To define a list of unordered elements

d)

To represent a composite data type

4.

How is an enumerated data type defined in pseudocode?

a)

TYPE TDays = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)

b)

ENUM TDays AS [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]

c)

TYPE ENUM TDays = Monday TO Sunday

d)

SET TDays = {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}

5.

What distinguishes a composite data type from a non-composite one?

a)

Composite data types refer to other data types in their definition.

b)

Non-composite data types store multiple values.

c)

Composite data types are built into programming languages.

d)

Non-composite data types are not used for special purposes.

6.

What is a hashing algorithm used for in file access?

a)

To store files in alphabetical order

b)

To encrypt data in a file

c)

To calculate the address of a record in a file

d)

To merge two sequential files

7.

Which file organization method is most efficient for temporary files?

a)

Random

b)

Sequential

c)

Serial

d)

Indexed

8.

What is the key characteristic of a sequential file organization?

a)

Records are stored based on a hashing algorithm.

b)

Records are stored in the order of arrival.

c)

Records are stored in ascending order of the key field.

d)

Records are stored in alphabetical order.

9.

What is an example of an enumerated data type?

a)

A list of customer names

b)

A collection of unique memory addresses

c)

A list of the months in a year

d)

A table of records with different fields

10.

What does an open hash do when a collision occurs?

a)

Deletes the previous record

b)

Moves the record to an overflow area

c)

Stores the record in the next available space

d)

Uses a different hashing algorithm

11.

What is the role of the key field in file organization?

a)

It determines the physical storage order of records.

b)

It represents the total size of a record.

c)

It provides encryption for secure data.

d)

It defines the file structure format.

12.

How does sequential access operate in a file?

a)

Records are accessed based on their memory address.

b)

Records are read one after another until the required record is found.

c)

Records are searched using an index.

d)

Records are accessed in any order using a hashing algorithm.

13.

What is the result of using a hashing algorithm on a key field?

a)

A sequence of all records in ascending order

b)

The location where the record should be stored or accessed

c)

An encrypted version of the key field

d)

The total number of records in a file

14.

Which of the following is an advantage of random file organization?

a)

It is the most straightforward method for appending records.

b)

It guarantees collision-free storage.

c)

Records can be accessed directly without searching sequentially.

d)

Records are always stored in ascending order.

15.

How does a closed hash handle collisions?

a)

Deletes the conflicting record

b)

Stores the record in an overflow area

c)

Replaces the old record with the new one

d)

Changes the hashing algorithm

16.

What does the term 'key field' refer to?

a)

A special identifier used to determine the order of records

b)

A pointer to another record in the file

c)

A reserved space in the file header

d)

A unique field used to encrypt file contents

17.

What is the primary use of serial file organization?

a)

For files that require quick random access

b)

For storing temporary transaction data

c)

For files requiring frequent updates

d)

For encrypted data storage

18.

In what order are records stored in sequential file organization?

a)

By arrival time

b)

By key field values

c)

By memory address

d)

By file creation time

19.

Why is a hashing algorithm necessary in random file organization?

a)

To sort the records in ascending order

b)

To encrypt the records before storing them

c)

To calculate storage locations for records

d)

To avoid the need for direct access

20.

What is a collision in hashing?

a)

When two records are assigned the same memory location

b)

When the hashing algorithm fails

c)

When a record cannot be located

d)

When a file exceeds its allocated size

21.

What does the term 'hit rate' refer to in file access?

a)

The percentage of records found directly during sequential access

b)

The number of records accessed in one operation

c)

The frequency with which a file is updated

d)

The percentage of records processed during file access

22.

Which of the following best describes a pointer?

a)

A variable storing a memory address

b)

A data type that stores numeric values

c)

A collection of unique elements

d)

A file storage mechanism

23.

What is the main disadvantage of sequential access?

a)

Records cannot be appended to the file.

b)

The entire file must be read to access a specific record.

c)

It requires an index to locate records.

d)

It uses a lot of memory.

24.

Which data type is most appropriate for storing the days of the week?

a)

Set

b)

Record

c)

Enumerated data type

d)

Pointer

25.

What happens if two key fields produce the same address using a hashing algorithm?

a)

The record is overwritten.

b)

A collision occurs.

c)

The file is re-indexed.

d)

The hashing algorithm is recalculated.

26.

Which of these is a composite data type?

a)

Record

b)

Enumerated data type

c)

Pointer

d)

Key field

27.

What is a key advantage of using direct access in file organization?

a)

Records can be processed in the order of arrival.

b)

Records can be accessed quickly without reading other records.

c)

Records are always sorted by the key field.

d)

Records are encrypted before storage.

28.

Which data type would you use for storing a unique set of memory addresses?

a)

Pointer

b)

Enumerated

c)

Composite

d)

Serial

29.

In file organization, what is a 'serial file'?

a)

A file where records are accessed directly.

b)

A file where records are stored in the order they are added.

c)

A file with an index for faster access.

d)

A file that uses a hashing algorithm to locate records.

30.

What is the purpose of an overflow area in hashing?

a)

To store large files that exceed the allocated space

b)

To store records that cannot be placed in their hashed location

c)

To backup the entire file

d)

To reorganize the file for better performance

31.

Which of the following is a composite data type?

a)

Class

b)

Enumerated

c)

Pointer

d)

Integer

32.

Which file organization method requires the use of a hashing algorithm?

a)

Sequential

b)

Random

c)

Serial

d)

Indexed

33.

What is the role of the key field in hashing?

a)

It uniquely identifies each record in the file.

b)

It serves as a pointer to a memory location.

c)

It encrypts data for secure storage.

d)

It organizes records in alphabetical order.

34.

What is a disadvantage of using random file organization?

a)

Records cannot be accessed directly.

b)

It requires a large amount of memory.

c)

Collisions can occur, requiring additional handling.

d)

Records must be stored sequentially.

35.

What is the primary use of an enumerated data type?

a)

To store large sets of records

b)

To define a list of all possible values with an implied order

c)

To access records directly using a key field

d)

To store the memory address of another data type

36.

What method does sequential access use to find a record?

a)

Searching from the beginning of the file one record at a time

b)

Using a hashing algorithm to calculate the location

c)

Referencing a memory address stored in a pointer

d)

Using an overflow area for unmatched records

37.

Which of these describes a set data type?

a)

It stores records with a unique key field.

b)

It is a composite data type that includes other data types.

c)

It stores unordered elements with set operations like union and intersection.

d)

It defines an ordered list of possible values.

38.

Which of the following is an example of a user-defined composite data type?

a)

Enumerated data type

b)

Pointer

c)

Record

d)

Integer

39.

What happens when a hashing collision occurs in an open hash system?

a)

The record is deleted.

b)

The record is stored in the next free space.

c)

The hashing algorithm is recalculated.

d)

The record is stored in an overflow area.

40.

48. How is data accessed in a sequential file using direct access?

a)

A) Using a pointer to directly locate the record

b)

B) Using an index to find the location of the record

c)

C) Searching the file record by record until the key field matches

d)

D) Using a hashing algorithm to calculate the address

41.

49. Why are hashing algorithms important for random file organization?

a)

A) They store records in ascending order.

b)

B) They provide encryption for file data.

c)

C) They calculate record locations efficiently.

d)

D) They eliminate collisions.

42.

50. Which composite data type includes methods and variables?

a)

A) Set

b)

B) Record

c)

C) Class

d)

D) Pointer

43.

51. What is the primary impact of increasing the size of the mantissa in a floating-point number representation?

a)

a) Increased range of representable numbers

b)

b) Improved precision in representing numbers

c)

c) Faster arithmetic operations

d)

d) Reduced memory usage

44.

A larger exponent in a floating-point number format primarily affects which aspect of the representation?

a)

a) The precision of the number

b)

 b) The range of representable numbers

c)

c) The speed of calculations

d)

d) The storage size of the number

45.

53. How does a larger mantissa influence the representation of very small numbers?

a)

a) It allows for more precise representation of very small numbers

b)

 b) It limits the representation of very small numbers

c)

c) It has no significant impact on the representation of very small numbers

d)

d) It increases the range of representable very small numbers

46.

54. In scientific notation, a larger exponent corresponds to a number that is:

a)

 a) Smaller in magnitude

b)

 b) Larger in magnitude

c)

c) More precise

d)

d) Less precise

47.

55. Which of the following scenarios would benefit the most from increasing the size of the mantissa in a floating-point representation?

a)

a) Representing very large integers

b)

 b) Performing integer arithmetic operations

c)

c) Representing very small fractions

d)

d) Storing text data

48.
What is a composite data type?
a)
A pointer that references a memory location
b)
An enumerated type
c)
A data type made up of multiple base data types
d)
A data type that only stores one base type
49.
Which of the following best describes a non-composite data type?
a)
A data type made of a single base type
b)
An ordered list of allowed values
c)
A type that mixes pointers and arrays
d)
A data type composed of different base types
50.
What is an enumerated (enum) type?
a)
A dynamic data structure
b)
A list of allowed values for a variable
c)
A data structure that stores pointers
d)
A composite type structure
51.
A pointer data type is classified as which kind of user defined type?
a)
Composite
b)
Non-composite
c)
Aggregated
d)
Enumerated
52.

Why are user-defined data types necessary in programming?

a)

They allow programmers to create structured and meaningful representations of data.

b)

They replace built-in data types entirely.

c)

They reduce the need for variables in a program.

d)

They prevent the use of arrays.

53.

Which of the following is a non-composite user-defined data type?

a)

Enumerated type

b)

Array

c)

Record

d)

Class

54.

What is the purpose of an enumerated type?

a)

It defines a variable that can hold a predefined set of values.

b)

It allows variables to store floating-point numbers.

c)

It dynamically allocates memory for objects.

d)

It creates a class for object-oriented programming.

55.

Which of the following is a valid enumerated type declaration in pseudocode?

a)

TYPE Day = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)

b)

ENUM Day = Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

c)

DECLARE Day AS ENUM(Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday)

d)

SET Day = Monday OR Tuesday OR Wednesday OR Thursday OR Friday OR Saturday OR Sunday

56.

What is a pointer used for in programming?

a)

It stores the memory address of another variable.

b)

It stores multiple values of different types.

c)

It creates an enumerated list of values.

d)

It defines a user-defined function.

57.

Which of the following statements about pointers is true?

a)

A pointer holds the memory address of a variable.

b)

A pointer is a composite data type.

c)

A pointer always points to a constant value.

d)

Pointers cannot be dereferenced.

58.

Which of the following is a composite data type?

a)

Record

b)

Enumerated type

c)

Pointer

d)

Boolean

59.

Which of the following is a correct definition of a record in pseudocode?

a)

TYPE StudentRecord DECLARE Name : STRING DECLARE Age : INTEGER DECLARE Grade : CHAR END TYPE

b)

RECORD StudentRecord Name : STRING Age : INTEGER Grade : CHAR END RECORD

c)

TYPE StudentRecord(Name STRING, Age INTEGER, Grade CHAR)

d)

SET StudentRecord = (Name, Age, Grade)

60.

Which composite data type represents a collection of unique elements?

a)

Set

b)

Array

c)

Pointer

d)

Record

61.

Which of the following statements is true about sets?

a)

A set contains only unique values and does not allow duplicates.

b)

A set can contain duplicate values.

c)

A set is the same as an array.

d)

A set can store elements of different data types in a single set.

62.

Why are user-defined data types necessary in programming?

a)

They allow programmers to create structured and meaningful representations of data.

b)

They replace built-in data types entirely.

c)

They reduce the need for variables in a program.

d)

They prevent the use of arrays.

63.

Which of the following is NOT a benefit of user-defined data types?

a)

They make debugging impossible.

b)

They improve code readability and maintainability.

c)

They allow for data abstraction and encapsulation.

d)

They help organize complex data structures.

64.

Which of the following is a non-composite user-defined data type?

a)

Enumerated type

b)

Array

c)

Record

d)

Class

65.

What is the purpose of an enumerated type?

a)

It defines a variable that can hold a predefined set of values.

b)

It allows variables to store floating-point numbers.

c)

It dynamically allocates memory for objects.

d)

It creates a class for object-oriented programming.

66.

What is a pointer used for in programming?

a)

It stores the memory address of another variable.

b)

It stores multiple values of different types.

c)

It creates an enumerated list of values.

d)

It defines a user-defined function.

67.

Which of the following statements about pointers is true?

a)

A pointer holds the memory address of a variable.

b)

A pointer is a composite data type.

c)

A pointer always points to a constant value.

d)

Pointers cannot be dereferenced.

68.

Which of the following is a composite data type?

a)

Record

b)

Enumerated type

c)

Pointer

d)

Boolean

69.

What is a record used for?

a)

To store a collection of different data types under one identifier.

b)

To store a single data type in a fixed-size array.

c)

To reference another variable’s memory address.

d)

To create a collection of similar values.

70.

Which of the following is a correct definition of a record in pseudocode?

a)

TYPE StudentRecord DECLARE Name : STRING DECLARE Age : INTEGER DECLARE Grade : CHAR END TYPE

b)

RECORD StudentRecord Name : STRING Age : INTEGER Grade : CHAR END RECORD

c)

TYPE StudentRecord(Name STRING, Age INTEGER, Grade CHAR)

d)

SET StudentRecord = (Name, Age, Grade)

71.

Which of the following is a characteristic of a class?

a)

It defines both data (attributes) and behavior (methods).

b)

It is only used for enumerations.

c)

It is a simple variable type with no functions.

d)

It cannot contain multiple data types.

72.

Which composite data type represents a collection of unique elements?

a)

Set

b)

Array

c)

Pointer

d)

Record

73.

Which of the following statements is true about sets?

a)

A set contains only unique values and does not allow duplicates.

b)

A set can contain duplicate values.

c)

A set is the same as an array.

d)

A set can store elements of different data types in a single set.

74.

Which user-defined type would be best suited to store the days of the week?

a)

Enumerated type

b)

Record

c)

Pointer

d)

Set

75.

If a program needs to store detailed information about a student (name, age, and grade), which data type should be used?

a)

Record

b)

Pointer

c)

Enumerated type

d)

Boolean

76.

Which of the following scenarios would be best suited for a pointer?

a)

When managing dynamic memory allocation in a program.

b)

When storing predefined constant values.

c)

When defining a list of allowed colors in an application.

d)

When creating a database of employee records.

77.

Which of the following is the best user-defined type to represent a shape with properties like width, height, and color?

a)

Class

b)

Set

c)

Pointer

d)

Enumerated type

78.

Why is choosing the right user-defined data type important?

a)

It ensures efficiency, readability, and maintainability of the program.

b)

It makes the code unnecessarily complex.

c)

It prevents the use of built-in data types.

d)

It allows data to be stored in only one format.

79.

How could we declare a variable called Book using this data type?

a)

DECLARE LibraryBookRecord TYPE Book


b)

DECLARE Book : TYPE LibraryBookRecord


c)

DECLARE Book : LibraryBookRecord


d)

DECLARE LibraryBookRecord : Book

80.

What pseudocode should be included here to define a set type?

TYPE <set-identifier> (a)   <Basetype>

81.

Which of these is the correct way to declare an enumerated data type that will consist of the three sports in a modern triathlon 


a)

DECLARE Ttriathlon = (swimming, cycling, running,)

b)

DECLARE Ttriathlon = ("swimming", "cycling", "running")

c)

TYPE Ttriathlon = (swimming, cycling, running,)

d)

TYPE Ttriathlon = ("swimming", "cycling", "running")