All mock tests are FREE till 31 December — register to save your progress
Paper 2 CS · UNIT 03 · MOCK TEST

Programming Languages and Computer Graphics — Mock Test 5

25 questions · about 30 minutes. Press End Mock any time to see your score and the correct answers.

0 / 25 answered 00:00
Q1. Which of the following UML diagrams has a static view?
Q2. Which of the following statements is/are TRUE?
P: In software engineering, defects that are discovered earlier are more expensive to fix.
Q: A software design is said to be a good design, if the components are strongly cohesive and weakly coupled.
Select the correct answer from the options given below:
Q3. Software coupling involves dependencies among pieces of software called modules. Which of the following are correct statements with respect to module coupling?
P: Common Coupling occurs when two modules share the same global data.
Q: Control Coupling occurs when modules share a composite data structure and use only part of it.
R: Content Coupling occurs when one module modifies or relies on the internal working of another module.
Q4. Match each UML diagram in List-I with the appropriate description in List-II:
List-I
(a) State Diagram
(b) Use-Case Diagram
(c) Class Diagram
(d) Activity Diagram
List-II
(i) Describes how the external entities (people, devices) can interact with the system
(ii) Used to describe the static or structural view of a system
(iii) Used to show the flow of a business process, the steps of a use-case or the logic of an object behaviour
(iv) Used to describe the dynamic behaviour of objects and could also be used to describe the entire system behaviour
Q5. Coupling is a measure of the strength of the interconnections between software modules. Which of the following are correct statements with respect to module coupling?
P: Common coupling occurs when one module controls the flow of another module by passing it information on what to do.
Q: In data coupling, the complete data structure is passed from one module to another through parameters.
R: Stamp coupling occurs when modules share a composite data structure and use only parts of it.
Q6. A software design pattern often used to restrict access to an object is:
Q7. Consider the following statements regarding software architecture:
S1: Coupling is a measure of how well the things grouped together in a module belong together logically.
S2: Cohesion is a measure of the degree of interaction between software modules.
S3: If coupling is low and cohesion is high then it is easier to change one module without affecting others.
Which of the following is true?
Q8. A software design pattern used to enhance the functionality of an object at run-time is:
Q9. Module design is used to maximize cohesion and minimize coupling. Which of the following is the key to implement this rule?
Q10. The design concept 'Refinement' is a:
Q11. A software design is highly modular if:
Q12. Cohesion is an extension of:
Q13. Given 4 GB (≈ 4.3 × 10⁹ bytes) of virtual address space and a page size of 4 KB (= 4 × 10³ bytes), with each page table entry 5 bytes: how many virtual pages would this imply, and what is the size of the whole page table?
Q14. A table T with 17 rows and 1024 columns is stored in memory. T[i][j] and the variable temp are 32-bit floating-point values; memory is word-addressable (1 word = 1 element) and temp is kept in a processor register (no memory reference for temp). Main memory can hold only 16 pages of 1024 words each, with LRU page replacement. The following program computes and prints the average of every column:
for j = 0 to 1023:
  temp = 0
  for i = 0 to 16:
    temp = temp + T[i][j]
  print(temp / 17.0)

If T is stored in the virtual address space in row-major format, what is the main memory hit ratio?
Q15. Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same column-averaging program as above, now consider T stored in column-major format. How many page faults will be encountered while running the program?
for j = 0 to 1023:
  temp = 0
  for i = 0 to 16:
    temp = temp + T[i][j]
  print(temp / 17.0)
Q16. Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same column-averaging program as above, now consider T stored in row-major format. How many page faults will be encountered while running the program?
for j = 0 to 1023:
  temp = 0
  for i = 0 to 16:
    temp = temp + T[i][j]
  print(temp / 17.0)
Q17. Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same column-averaging program as above, now consider T stored again in column-major format. What is the main memory hit ratio?
for j = 0 to 1023:
  temp = 0
  for i = 0 to 16:
    temp = temp + T[i][j]
  print(temp / 17.0)
Q18. Using the same table T (17 rows × 1024 columns, 32-bit word-addressable entries, 16 page frames of 1024 words each, LRU) and the same column-averaging program as above, what is the ratio of the number of page faults with T stored in row-major order to the number of page faults with T stored in column-major order?
for j = 0 to 1023:
  temp = 0
  for i = 0 to 16:
    temp = temp + T[i][j]
  print(temp / 17.0)
Q19. A virtual memory system uses the first-in-first-out (FIFO) page replacement policy and allocates a fixed number of frames to a process.
Assertion A: Increasing the number of page frames allocated to a process sometimes increases the page fault rate.
Reason R: Some programs do not exhibit locality of reference.
Q20. Which of the following statement(s) is/are correct with respect to virtual memory?
Statement I: Address translation is performed for every logical address used during the execution of a program.
Statement II: A program can execute only when all of its components are loaded in memory.
Q21. Which of the statement is not true in regards to virtual memory?
(i) The main objective for using virtual memory is to increase the effective capacity of the memory system.
(ii) Size of the program can be as large as the size of the secondary memory.
(iii) Program and data are stored in the secondary memory.
Q22. For the following page reference string: 4, 3, 2, 1, 4, 3, 5, 4, 3, 2, 1, 5 — the number of page faults that occur using the Least Recently Used (LRU) page replacement algorithm with frame size 3 is:
Q23. Given memory access time as p nanoseconds and an additional q nanoseconds for handling a page fault, what is the effective memory access time if a page fault occurs once for every 100 instructions?
Q24. Consider a machine with 16 GB of main memory and a 32-bit virtual address space, with page size 4 KB (frame size equals page size). If a process of size 34 KB is to be executed on this machine, what will be the size of internal fragmentation for this process?
Q25. (Same machine as above: 16 GB main memory, 32-bit virtual address space, 4 KB page size.) What is the size of the page table needed to handle the given virtual address space, given that each page table entry is of size 2 bytes?