System Programming MCQs with Answers
Practice important System Programming MCQs with answers and explanations.
Chapter: 78
Q1581:
In the syntax `type _based(base) declarator`, the `base` refers to _______.
A. the base pointer to which offsets are relative
B. the start of the file
C. the size of the file
D. the physical memory address
Correct Answer:
A
Chapter: 78
Q1582:
Which of the following statements about based pointers is TRUE?
A. They are absolute memory addresses
B. They are offsets relative to another pointer
C. They cannot be used with MapViewOfFile
D. They always point to static memory
Correct Answer:
B
Chapter: 78
Q1583:
The declaration `DWORD _based(pInFile) *pSize;` means pSize is a pointer based relative to _______.
A. pInFile
B. NULL
C. the base of the program
D. file size
Correct Answer:
A
Chapter: 78
Q1584:
The syntax for based pointers forces the use of which operator?
A. &
B. *
C. ->
D. .
Correct Answer:
B
Chapter: 78
Q1585:
Based pointers are used to ensure pointer values are valid _______.
A. only within a single program execution
B. between different program executions
C. across multiple mapped file views
D. only for stack variables
Correct Answer:
C
Chapter: 78
Q1586:
A typedef can be used to fix the awkward syntax of based pointers that requires explicit use of _______.
A. *
B. &
C. ->
D. .
Correct Answer:
A
Chapter: 78
Q1587:
Pointers stored in a mapped file should be _______ to remain valid when the file is remapped.
A. absolute
B. based
C. on the heap
D. ignored
Correct Answer:
B
Chapter: 78
Q1588:
Based pointers store offsets relative to another pointer rather than _______.
A. absolute memory addresses
B. function addresses
C. static variables
D. local variables
Correct Answer:
A
Chapter: 78
Q1589:
In Visual C++, the `_based` keyword allows pointers to be _______.
A. relative offsets
B. absolute addresses
C. constants
D. variables
Correct Answer:
A
Chapter: 78
Q1590:
The pointer `pInFile` in the example is initialized to _______.
A. NULL
B. a valid memory address
C. the base address of the file
D. the current stack pointer
Correct Answer:
A
Chapter: 78
Q1591:
The use of based pointers helps overcome the problem of _______ in memory mapped files.
A. invalid pointer references
B. pointer arithmetic
C. errors in file I/O
D. lack of memory
Correct Answer:
A
Chapter: 78
Q1592:
Using based pointers, the offsets are calculated relative to _______.
A. a pointer specified by the programmer
B. the start of the memory
C. memory page size
D. the system heap
Correct Answer:
A
Chapter: 78
Q1593:
Based pointers are particularly useful in which context?
A. Memory-mapped files
B. Network programming
C. GUI design
D. File compression
Correct Answer:
A
Chapter: 79
Q1594:
What is the main disadvantage of sorting huge files each time they are accessed?
A. It consumes too much CPU
B. It takes a long time
C. It's not feasible
D. All of the above
Correct Answer:
D
Chapter: 79
Q1595:
To avoid repeated sorting of large memory-mapped files, _______ are maintained.
A. snapshots
B. backup files
C. permanent indexes
D. pointer lists
Correct Answer:
C
Chapter: 79
Q1596:
Why is using the address returned by MapViewOfFile() for maintaining indexes not reliable?
A. It changes every time
B. MapViewOfFile doesn't return addresses
C. It's a static address
D. It returns file size
Correct Answer:
A
Chapter: 79
Q1597:
An effective alternative to storing absolute addresses in a memory-mapped file is to use _______.
A. file offsets
B. array indexes
C. global pointers
D. structs with addresses
Correct Answer:
B
Chapter: 79
Q1598:
In the given example, each record uses the first field as a key of how many characters?
A. 4
B. 6
C. 8
D. 10
Correct Answer:
C
Chapter: 79
Q1599:
How many file mappings are used in the example program?
A. 1
B. 2
C. 3
D. 4
Correct Answer:
B
Chapter: 79
Q1600:
The second file mapping is created for the purpose of _______.
A. sorting the input file
B. storing record lengths
C. storing the index file
D. mapping memory to heap
Correct Answer:
C