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
- What is 20% of 250?
- A. 25
- B. 40
- C. 50
-
D. 75
-
A value rises by 10% and then by 20%. What is the net percentage increase?
- A. 30%
- B. 32%
- C. 28%
-
D. 22%
-
An item costs 800 and sells for 920. What is the profit percentage?
- A. 12%
- B. 15%
- C. 18%
-
D. 20%
-
A:B = 2:3 and A+B = 75. What is A?
- A. 25
- B. 30
- C. 35
-
D. 45
-
The average of five numbers is 12. If one number, 8, is removed, what is the average of the remaining numbers?
- A. 11
- B. 12
- C. 13
-
D. 15
-
Ten workers complete a job in 12 days. How many days would fifteen equally efficient workers take?
- A. 6
- B. 8
- C. 10
-
D. 18
-
A 150 m train moves at 54 km/h. How many seconds does it take to pass a pole?
- A. 8
- B. 10
- C. 12
-
D. 15
-
Find the simple interest on 5,000 at 10% per annum for two years.
- A. 500
- B. 750
- C. 1,000
-
D. 1,500
-
A bag has three red and five blue balls. What is the probability of selecting a red ball?
- A. 3/5
- B. 3/8
- C. 5/8
-
D. 1/3
-
What is the unit digit of 2 raised to power 27?
- A. 2
- B. 4
- C. 6
- D. 8
English
- Choose the correct sentence.
- A. Either of the plans are acceptable.
- B. Either of the plans is acceptable.
- C. Either of the plan are acceptable.
-
D. Either plans is acceptable.
-
She is interested ___ data science.
- A. on
- B. at
- C. in
-
D. for
-
Choose the grammatically correct sentence.
- A. The committee have submitted its report.
- B. The committee has submitted its report.
- C. The committee has submitted their report.
-
D. The committee have submitted their report.
-
By the time we arrived, the film ___.
- A. starts
- B. has started
- C. had started
-
D. was start
-
Meticulous most nearly means:
- A. careless
- B. very careful
- C. extremely noisy
-
D. uncertain
-
Choose the antonym of scarce.
- A. rare
- B. limited
- C. abundant
-
D. insufficient
-
Choose the correct usage.
- A. She is senior than me.
- B. She is senior to me.
- C. She is more senior than me.
-
D. She is senior from me.
-
He is ___ European citizen.
- A. a
- B. an
- C. the
-
D. no article
-
Change to passive voice: "They will complete the work tomorrow."
- A. The work will complete tomorrow.
- B. The work will be completed tomorrow.
- C. The work is completed tomorrow.
-
D. The work has completed tomorrow.
-
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?
- A. Green roofs have no environmental benefit.
- B. Green roofs always cost less.
- C. Green roofs have environmental benefits but may require higher initial spending.
- D. Conventional roofs absorb more rainwater.
Reasoning
- Find the next number: 4, 9, 16, 25, __.
- A. 30
- B. 32
- C. 36
-
D. 49
-
A person walks 5 km north, then 5 km east, then 5 km south. Where is the person from the start?
- A. north
- B. south
- C. east
-
D. west
-
All A are B. No B are C. Which conclusion definitely follows?
- A. Some A are C.
- B. No A are C.
- C. All C are A.
-
D. Some B are C.
-
If each letter is shifted one position forward, DOG becomes EPH. What does CAT become?
- A. DBU
- B. CAU
- C. DZT
-
D. EBU
-
A is B's sister. C is A's mother. How is C related to B?
- A. aunt
- B. sister
- C. mother
-
D. grandmother
-
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?
- A. A
- B. B
- C. C
-
D. E
-
All roses are flowers. Some flowers fade quickly. Which conclusion definitely follows?
- A. Some roses fade quickly.
- B. No roses fade quickly.
- C. All flowers are roses.
-
D. Neither A nor B definitely follows.
-
What is the smaller angle between the hands of a clock at 3:30?
- A. 60 degrees
- B. 75 degrees
- C. 90 degrees
-
D. 105 degrees
-
P is north of Q. R is east of P. S is south of R. S is in which direction from Q?
- A. north
- B. south
- C. east
-
D. west
-
Find the next pair: AZ, BY, CX, __.
- A. DV
- B. DW
- C. DX
- D. EW
Section B ā Technical (30 minutes)
- Which data structure follows FIFO order?
- A. Stack
- B. Queue
- C. Heap
-
D. Tree
-
Which traversal of a binary search tree returns keys in sorted order?
- A. Preorder
- B. Postorder
- C. Inorder
-
D. Level order
-
What is the average lookup time of a well-designed hash table?
- A. O(1)
- B. O(log n)
- C. O(n)
-
D. O(n log n)
-
Which sorting algorithm is especially suitable for a singly linked list?
- A. Selection sort
- B. Merge sort
- C. Heap sort only
-
D. Binary search
-
Which algorithm finds a shortest path in an unweighted graph?
- A. DFS
- B. BFS
- C. Dijkstra only
-
D. Quicksort
-
Which statement is true?
- A. Threads in a process have separate address spaces.
- B. Processes always share heap memory.
- C. Threads in a process commonly share the process address space.
-
D. A thread cannot be scheduled.
-
Which CPU scheduling method uses a fixed time quantum?
- A. FCFS
- B. Round Robin
- C. SJF
-
D. Priority aging
-
A requested virtual-memory page is not in RAM. This is:
- A. cache hit
- B. page fault
- C. deadlock
-
D. fragmentation
-
Which is not one of the four necessary deadlock conditions?
- A. mutual exclusion
- B. hold and wait
- C. preemption allowed
-
D. circular wait
-
Paging divides memory into:
- A. variable-sized logical segments only
- B. fixed-sized pages and frames
- C. one continuous block
-
D. stack and queue blocks
-
Which is a primary advantage of a microcontroller in an embedded product?
- A. It always needs external RAM and I/O.
- B. CPU, memory and I/O can be integrated on one chip.
- C. It cannot handle interrupts.
-
D. It is intended only for desktop operating systems.
-
Which component converts an analogue sensor voltage into a digital number?
- A. DAC
- B. ADC
- C. PWM
-
D. GPIO
-
Which component can recover an unattended controller from a software hang?
- A. cache
- B. watchdog timer
- C. compiler
-
D. heat sink
-
Which serial interface is commonly two-wire and addressed?
- A. UART
- B. SPI
- C. I2C
-
D. HDMI
-
Which statement best describes UART?
- A. It is normally asynchronous serial communication using transmit/receive lines.
- B. It is a routing protocol.
- C. It converts analogue values to digital values.
-
D. It is only a storage technology.
-
Which transport protocol provides ordered, reliable delivery?
- A. UDP
- B. TCP
- C. ARP
-
D. ICMP
-
Which protocol has lower overhead but no delivery guarantee?
- A. TCP
- B. UDP
- C. HTTP
-
D. FTP
-
IP routing belongs primarily to which OSI layer?
- A. Data Link
- B. Network
- C. Transport
-
D. Application
-
What is the conventional default port for DNS?
- A. 22
- B. 25
- C. 53
-
D. 80
-
A /27 IPv4 subnet has how many traditional usable host addresses?
- A. 14
- B. 30
- C. 62
-
D. 126
-
ARP maps:
- A. domain name to IP address
- B. IP address to MAC address on local network
- C. TCP port to process
-
D. private IP to public IP
-
DHCP is used mainly to:
- A. encrypt web traffic
- B. assign IP configuration automatically
- C. resolve domain names
-
D. route packets between networks
-
Which HTTP status most directly indicates that credentials are required/invalid?
- A. 200
- B. 301
- C. 401
-
D. 404
-
Which development model is most sequential and best when requirements are stable?
- A. Agile
- B. Waterfall
- C. DevOps
-
D. Kanban only
-
In Scrum, a short time-boxed development iteration is called:
- A. branch
- B. sprint
- C. build
-
D. defect
-
Continuous integration mainly means:
- A. writing no tests until release
- B. frequently merging changes with automated build/test feedback
- C. manually deploying once a year
-
D. replacing all version control
-
Testing existing features after a code change is:
- A. regression testing
- B. retesting only
- C. alpha testing only
-
D. static analysis only
-
For a valid input range of 1 to 50, which set is a standard boundary-value set?
- A. 1, 2, 49, 50
- B. 0, 1, 50, 51
- C. 10, 20, 30, 40
-
D. -10, 0, 10, 60
-
Selenium is best known as a:
- A. UI web-test automation tool
- B. relational database
- C. compiler
-
D. DNS server
-
Severity in defect reporting mainly refers to:
- A. order in which a developer happens to fix a defect
- B. technical/business impact of the defect
- C. number of test cases written
- D. length of a defect title
Section C ā Pseudocode (20 minutes)
- 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]].