Mock 01 Questions
Dashboard Download PDF

tags: - cocubes - mock - timed


Mock 01 — Questions

Original CoCubes-style practice. Do not open [[08_Timed_Mocks/Mock_01_Answers|answers]] until your timer ends.

Rules

  • Aptitude: 30 questions, 30 minutes.
  • Technical: 30 questions, 30 minutes.
  • Pseudocode: 20 questions, 20 minutes.
  • Coding: 2 problems, 30 minutes.
  • Use rough paper. Do not pause the timer.

Section A — Aptitude (30 minutes)

Quantitative aptitude

  1. What is 20% of 250?
  2. A. 25
  3. B. 40
  4. C. 50
  5. D. 75

  6. A value rises by 10% and then by 20%. What is the net percentage increase?

  7. A. 30%
  8. B. 32%
  9. C. 28%
  10. D. 22%

  11. An item costs 800 and sells for 920. What is the profit percentage?

  12. A. 12%
  13. B. 15%
  14. C. 18%
  15. D. 20%

  16. A:B = 2:3 and A+B = 75. What is A?

  17. A. 25
  18. B. 30
  19. C. 35
  20. D. 45

  21. The average of five numbers is 12. If one number, 8, is removed, what is the average of the remaining numbers?

  22. A. 11
  23. B. 12
  24. C. 13
  25. D. 15

  26. Ten workers complete a job in 12 days. How many days would fifteen equally efficient workers take?

  27. A. 6
  28. B. 8
  29. C. 10
  30. D. 18

  31. A 150 m train moves at 54 km/h. How many seconds does it take to pass a pole?

  32. A. 8
  33. B. 10
  34. C. 12
  35. D. 15

  36. Find the simple interest on 5,000 at 10% per annum for two years.

  37. A. 500
  38. B. 750
  39. C. 1,000
  40. D. 1,500

  41. A bag has three red and five blue balls. What is the probability of selecting a red ball?

  42. A. 3/5
  43. B. 3/8
  44. C. 5/8
  45. D. 1/3

  46. What is the unit digit of 2 raised to power 27?

  47. A. 2
  48. B. 4
  49. C. 6
  50. D. 8

English

  1. Choose the correct sentence.
  2. A. Either of the plans are acceptable.
  3. B. Either of the plans is acceptable.
  4. C. Either of the plan are acceptable.
  5. D. Either plans is acceptable.

  6. She is interested ___ data science.

  7. A. on
  8. B. at
  9. C. in
  10. D. for

  11. Choose the grammatically correct sentence.

  12. A. The committee have submitted its report.
  13. B. The committee has submitted its report.
  14. C. The committee has submitted their report.
  15. D. The committee have submitted their report.

  16. By the time we arrived, the film ___.

  17. A. starts
  18. B. has started
  19. C. had started
  20. D. was start

  21. Meticulous most nearly means:

  22. A. careless
  23. B. very careful
  24. C. extremely noisy
  25. D. uncertain

  26. Choose the antonym of scarce.

  27. A. rare
  28. B. limited
  29. C. abundant
  30. D. insufficient

  31. Choose the correct usage.

  32. A. She is senior than me.
  33. B. She is senior to me.
  34. C. She is more senior than me.
  35. D. She is senior from me.

  36. He is ___ European citizen.

  37. A. a
  38. B. an
  39. C. the
  40. D. no article

  41. Change to passive voice: "They will complete the work tomorrow."

  42. A. The work will complete tomorrow.
  43. B. The work will be completed tomorrow.
  44. C. The work is completed tomorrow.
  45. D. The work has completed tomorrow.

  46. Read the statement: "Green roofs can lower urban temperature and absorb rainwater. Their installation cost is often higher than a conventional roof." Which statement is supported?

  47. A. Green roofs have no environmental benefit.
  48. B. Green roofs always cost less.
  49. C. Green roofs have environmental benefits but may require higher initial spending.
  50. D. Conventional roofs absorb more rainwater.

Reasoning

  1. Find the next number: 4, 9, 16, 25, __.
  2. A. 30
  3. B. 32
  4. C. 36
  5. D. 49

  6. A person walks 5 km north, then 5 km east, then 5 km south. Where is the person from the start?

  7. A. north
  8. B. south
  9. C. east
  10. D. west

  11. All A are B. No B are C. Which conclusion definitely follows?

  12. A. Some A are C.
  13. B. No A are C.
  14. C. All C are A.
  15. D. Some B are C.

  16. If each letter is shifted one position forward, DOG becomes EPH. What does CAT become?

  17. A. DBU
  18. B. CAU
  19. C. DZT
  20. D. EBU

  21. A is B's sister. C is A's mother. How is C related to B?

  22. A. aunt
  23. B. sister
  24. C. mother
  25. D. grandmother

  26. Five people A, B, C, D and E sit in a row of five seats. A is in the middle. B sits immediately left of A. C sits immediately right of A. D sits at the left end. Who sits at the right end?

  27. A. A
  28. B. B
  29. C. C
  30. D. E

  31. All roses are flowers. Some flowers fade quickly. Which conclusion definitely follows?

  32. A. Some roses fade quickly.
  33. B. No roses fade quickly.
  34. C. All flowers are roses.
  35. D. Neither A nor B definitely follows.

  36. What is the smaller angle between the hands of a clock at 3:30?

  37. A. 60 degrees
  38. B. 75 degrees
  39. C. 90 degrees
  40. D. 105 degrees

  41. P is north of Q. R is east of P. S is south of R. S is in which direction from Q?

  42. A. north
  43. B. south
  44. C. east
  45. D. west

  46. Find the next pair: AZ, BY, CX, __.

  47. A. DV
  48. B. DW
  49. C. DX
  50. D. EW

Section B — Technical (30 minutes)

  1. Which data structure follows FIFO order?
  2. A. Stack
  3. B. Queue
  4. C. Heap
  5. D. Tree

  6. Which traversal of a binary search tree returns keys in sorted order?

  7. A. Preorder
  8. B. Postorder
  9. C. Inorder
  10. D. Level order

  11. What is the average lookup time of a well-designed hash table?

  12. A. O(1)
  13. B. O(log n)
  14. C. O(n)
  15. D. O(n log n)

  16. Which sorting algorithm is especially suitable for a singly linked list?

  17. A. Selection sort
  18. B. Merge sort
  19. C. Heap sort only
  20. D. Binary search

  21. Which algorithm finds a shortest path in an unweighted graph?

  22. A. DFS
  23. B. BFS
  24. C. Dijkstra only
  25. D. Quicksort

  26. Which statement is true?

  27. A. Threads in a process have separate address spaces.
  28. B. Processes always share heap memory.
  29. C. Threads in a process commonly share the process address space.
  30. D. A thread cannot be scheduled.

  31. Which CPU scheduling method uses a fixed time quantum?

  32. A. FCFS
  33. B. Round Robin
  34. C. SJF
  35. D. Priority aging

  36. A requested virtual-memory page is not in RAM. This is:

  37. A. cache hit
  38. B. page fault
  39. C. deadlock
  40. D. fragmentation

  41. Which is not one of the four necessary deadlock conditions?

  42. A. mutual exclusion
  43. B. hold and wait
  44. C. preemption allowed
  45. D. circular wait

  46. Paging divides memory into:

  47. A. variable-sized logical segments only
  48. B. fixed-sized pages and frames
  49. C. one continuous block
  50. D. stack and queue blocks

  51. Which is a primary advantage of a microcontroller in an embedded product?

  52. A. It always needs external RAM and I/O.
  53. B. CPU, memory and I/O can be integrated on one chip.
  54. C. It cannot handle interrupts.
  55. D. It is intended only for desktop operating systems.

  56. Which component converts an analogue sensor voltage into a digital number?

  57. A. DAC
  58. B. ADC
  59. C. PWM
  60. D. GPIO

  61. Which component can recover an unattended controller from a software hang?

  62. A. cache
  63. B. watchdog timer
  64. C. compiler
  65. D. heat sink

  66. Which serial interface is commonly two-wire and addressed?

  67. A. UART
  68. B. SPI
  69. C. I2C
  70. D. HDMI

  71. Which statement best describes UART?

  72. A. It is normally asynchronous serial communication using transmit/receive lines.
  73. B. It is a routing protocol.
  74. C. It converts analogue values to digital values.
  75. D. It is only a storage technology.

  76. Which transport protocol provides ordered, reliable delivery?

  77. A. UDP
  78. B. TCP
  79. C. ARP
  80. D. ICMP

  81. Which protocol has lower overhead but no delivery guarantee?

  82. A. TCP
  83. B. UDP
  84. C. HTTP
  85. D. FTP

  86. IP routing belongs primarily to which OSI layer?

  87. A. Data Link
  88. B. Network
  89. C. Transport
  90. D. Application

  91. What is the conventional default port for DNS?

  92. A. 22
  93. B. 25
  94. C. 53
  95. D. 80

  96. A /27 IPv4 subnet has how many traditional usable host addresses?

  97. A. 14
  98. B. 30
  99. C. 62
  100. D. 126

  101. ARP maps:

  102. A. domain name to IP address
  103. B. IP address to MAC address on local network
  104. C. TCP port to process
  105. D. private IP to public IP

  106. DHCP is used mainly to:

  107. A. encrypt web traffic
  108. B. assign IP configuration automatically
  109. C. resolve domain names
  110. D. route packets between networks

  111. Which HTTP status most directly indicates that credentials are required/invalid?

  112. A. 200
  113. B. 301
  114. C. 401
  115. D. 404

  116. Which development model is most sequential and best when requirements are stable?

  117. A. Agile
  118. B. Waterfall
  119. C. DevOps
  120. D. Kanban only

  121. In Scrum, a short time-boxed development iteration is called:

  122. A. branch
  123. B. sprint
  124. C. build
  125. D. defect

  126. Continuous integration mainly means:

  127. A. writing no tests until release
  128. B. frequently merging changes with automated build/test feedback
  129. C. manually deploying once a year
  130. D. replacing all version control

  131. Testing existing features after a code change is:

  132. A. regression testing
  133. B. retesting only
  134. C. alpha testing only
  135. D. static analysis only

  136. For a valid input range of 1 to 50, which set is a standard boundary-value set?

  137. A. 1, 2, 49, 50
  138. B. 0, 1, 50, 51
  139. C. 10, 20, 30, 40
  140. D. -10, 0, 10, 60

  141. Selenium is best known as a:

  142. A. UI web-test automation tool
  143. B. relational database
  144. C. compiler
  145. D. DNS server

  146. Severity in defect reporting mainly refers to:

  147. A. order in which a developer happens to fix a defect
  148. B. technical/business impact of the defect
  149. C. number of test cases written
  150. D. length of a defect title

Section C — Pseudocode (20 minutes)

  1. What is displayed?
SET s = 0
FOR i = 1 TO 5
  IF i MOD 2 = 0 THEN SET s = s + i
END FOR
DISPLAY s
  • A. 5
  • B. 6
  • C. 9
  • D. 15

  • What is displayed?

SET n = 305, r = 0
WHILE n > 0
  SET r = r * 10 + (n MOD 10)
  SET n = n DIV 10
END WHILE
DISPLAY r
  • A. 305
  • B. 503
  • C. 53
  • D. 8

  • What is G(4)?

FUNCTION G(n)
  IF n <= 1 THEN RETURN 1
  ELSE RETURN n * G(n - 1)
END FUNCTION
  • A. 4
  • B. 10
  • C. 24
  • D. 120

  • What is displayed?

SET a = 3, b = 5
SET a = a + b
SET b = a - b
SET a = a - b
DISPLAY a, b
  • A. 3, 5
  • B. 5, 3
  • C. 8, 3
  • D. 5, 8

  • What is displayed?

SET x = 1
WHILE x < 20
  SET x = x * 3
END WHILE
DISPLAY x
  • A. 9
  • B. 18
  • C. 20
  • D. 27

  • What is displayed?

SET c = 0
REPEAT
  SET c = c + 2
UNTIL c >= 5
DISPLAY c
  • A. 4
  • B. 5
  • C. 6
  • D. 8

  • What is displayed?

SET x = 7, y = 7
IF x > y THEN
  DISPLAY "greater"
ELSE
  IF x = y THEN DISPLAY "equal"
  ELSE DISPLAY "less"
  END IF
END IF
  • A. greater
  • B. equal
  • C. less
  • D. no output

  • What is displayed?

SET c = 0
FOR i = 10 TO 16
  IF i MOD 3 = 1 THEN SET c = c + 1
END FOR
DISPLAY c
  • A. 2
  • B. 3
  • C. 4
  • D. 7

  • What is the time complexity?

FOR i = 1 TO n
  SET j = 1
  WHILE j <= n
    SET j = j * 2
  END WHILE
END FOR
  • A. O(1)
  • B. O(log n)
  • C. O(n)
  • D. O(n log n)

  • What is displayed?

SET p = 2, q = 3
SET r = p
SET p = q
SET q = r
DISPLAY p, q
  • A. 2, 3
  • B. 3, 2
  • C. 3, 3
  • D. 2, 2

  • What is displayed?

SET n = 729, sum = 0
WHILE n > 0
  SET sum = sum + (n MOD 10)
  SET n = n DIV 10
END WHILE
DISPLAY sum
  • A. 9
  • B. 16
  • C. 18
  • D. 27

  • What is H(5)?

FUNCTION H(n)
  IF n <= 0 THEN RETURN 0
  ELSE RETURN n + H(n - 2)
END FUNCTION
  • A. 5
  • B. 6
  • C. 9
  • D. 15

  • An array is explicitly indexed from 1 to 4: A[1]=2, A[2]=4, A[3]=6, A[4]=8. What is displayed?

SET s = 0
FOR i = 1 TO 4
  SET s = s + A[i]
END FOR
DISPLAY s
  • A. 16
  • B. 18
  • C. 20
  • D. 22

  • What is displayed?

SET n = 14
CASE n MOD 3 OF
  0: DISPLAY "A"
  1: DISPLAY "B"
  2: DISPLAY "C"
END CASE
  • A. A
  • B. B
  • C. C
  • D. no output

  • What is displayed?

SET a = 9, b = 4
IF a DIV b > 2 THEN
  DISPLAY "H"
ELSE
  DISPLAY "L"
END IF
  • A. H
  • B. L
  • C. 2
  • D. error

  • What sequence is displayed?

SET f = 0, g = 1
FOR i = 1 TO 3
  DISPLAY f
  SET f = f + g
  SET g = f + g
END FOR
  • A. 0, 1, 3
  • B. 0, 1, 1
  • C. 1, 2, 3
  • D. 0, 2, 4

  • How many times does the loop body execute?

SET n = 20, c = 0
WHILE n > 0
  SET n = n DIV 2
  SET c = c + 1
END WHILE
  • A. 4
  • B. 5
  • C. 6
  • D. 20

  • What is the time complexity?

SET i = 1
WHILE i <= n
  SET i = i * 2
END WHILE
  • A. O(1)
  • B. O(log n)
  • C. O(n)
  • D. O(n²)

  • What is displayed?

SET x = 10
IF NOT (x < 5 OR x > 12) THEN
  DISPLAY "yes"
ELSE
  DISPLAY "no"
END IF
  • A. yes
  • B. no
  • C. 10
  • D. no output

  • What happens?

SET n = 1
WHILE n != 0
  SET n = n + 2
END WHILE
DISPLAY n
  • A. Displays 0
  • B. Displays 1
  • C. Infinite loop for normal integers without overflow
  • D. Displays 3

Section D — Coding (30 minutes)

Coding Problem 1 — Two sum positions

Given an integer array of length n and integer target T, print any two distinct zero-based positions whose values sum to T. If no such pair exists, print -1.

Input:

n
a1 a2 ... an
T

Output:

i j

or:

-1

Example:

Input
5
2 7 11 15 3
10

Output
1 4

Constraints: 2 <= n <= 200000. Values may be negative.

Coding Problem 2 — Longest equal-half digit substring

Given a string S of decimal digits, find the maximum even length L for which S contains a contiguous substring of length L whose first half and second half have equal digit sums. Print L; print 0 if no such substring exists.

Example:

Input
123123

Output
6

Explanation: 123 and 123 have equal digit sums.

Constraints: 1 <= length(S) <= 2000.

When time ends, open [[08_Timed_Mocks/Mock_01_Answers|Mock 01 answers]].