If base class contains 2 nested classes, will it be possible to implement single level inheritance?
Answer options:
• Yes, only if derived class also have nested classes
• No, never (selected)
• No, it will use more than 2 classes which is wrong
• Yes, always
Correct Answer:
The correct answer is: Yes, always
What will be the output of the following Java code?
java
public class Test{
public static void main(String[] args){
int a = 10;
int b = 10;
System.out.println((a == b) + " " + (a.equals(b)));
Answer options:
• false false
• true false
• Compilation error (selected)
• true true
Correct Answer:
Compilation error
1 Integer total = 0
2 for i = 0 to 3
3 for j = 0 to 3
4 if ((i - j) mod 4 == 0)
5 total = total - 1
6 continue
7 end if
8 total = total + 1
9 end for
10 end for
11 print total
What is the printed output?
Options:
• 1
• 0
• 4
• -1
Correct answer: 8 (None of the given options is correct)
Which concept is demonstrated by function overriding?
Options:
a) Abstraction
b) Encapsulation
c) Polymorphism
d) Inheritance
Answer:
c) Polymorphism
In class B if subnet mask is 255.192.0.0, total number of networks that can be joined is ______.
Options:
a) 32
b) 16
c) None of the mentioned
d) 64
Correct Answer:
None of the mentioned (because 4 is not listed among the options).
For threads belonging to same process, which of the following resources is not shared among these
threads?
Options:
a) Stack
b) Code
c) Data
d) File Handles
Answer:
a) Stack
What will be the output of this C code?
int i = 5;
int x = ++i, y = i++;
printf("%d %d", x, y);
Options:
a) 5,6
b) 6,6
c) 6,5
d) 5,5
Answer:
b) 6,6
What is the difference between TCP and UDP protocols?
Options:
a) UDP is connection-oriented, while TCP is connectionless
b) TCP guarantees packet delivery, while UDP does not
c) TCP is faster than UDP
d) UDP is more reliable for large data transfers
Answer:
b) TCP guarantees packet delivery, while UDP does not
Analyze the effect of having a hash function with poor randomness in a distributed cache system:
Options:
a) It will improve the cache hit rate due to predictable hashing
b) It will prevent the cache system from functioning
c) It will decrease the overall cache hit rate
d) It can lead to uneven load distribution amongst the cache servers
Answer:
d) It can lead to uneven load distribution amongst the cache servers
Which of the following is false about Kruskal's algorithm?
Options:
a) It constructs MST by selecting edges in increasing order of their weights
b) It is a greedy algorithm
c) It uses union-find data structure
d) It can accept cycles in the MST
Answer:
d) It can accept cycles in the MST (False statement)
Which of the following methods for passing a pointer to a function is incorrect?
Options:
a) Non-constant pointer to non-constant data
b) A non-constant pointer to constant data
c) A constant pointer to non-constant data
d) All of the mentioned
Answer:
d) All of the mentioned
Which of the following operations requires modifying two pointers in a doubly linked list?
Options:
a) All of the mentioned
b) Insertion at the end
c) Insertion at the beginning
d) Deletion of a node
Answer:
a) All of the mentioned
Which one of the following is not an application layer protocol?
Options:
a) Dynamic host configuration protocol
b) Media gateway protocol
c) Session initiation protocol
d) Resource reservation protocol
Answer:
d) Resource reservation protocol
In a simple graph of n vertices what can be the maximum degree of any vertex?
Options:
a) n - 1
b) n + 1
c) n
d) 2n - 1
Answer:
a) n - 1
Consider sorting n distinct elements in ascending order using Bubble Sort.
What is the best case scenario for Bubble Sort?
Options:
A) The elements are in ascending order. (Correct Answer)
B) The elements are in descending order.
C) The elements are not in random order.
D) There is no best case for Bubble Sort.
Correct Answer:
✔ The elements are in ascending order.
A virtual memory system uses First In First Out (FIFO) page replacement policy and allocates a fixed
number of frames to a process. Consider the following statements.
P: Increasing the number of page frames allocated to a process sometimes increases the page fault
rate.
Q: Some programs do not exhibit locality of reference.
Which of the following is TRUE?
Options:
A) Both P and Q are false
B) P is false but Q is true
C) Both P and Q are true, but Q is not the reason for P (Correct Answer)
D) Both P and Q are true, and Q is the reason for P
Correct Answer:
✔ Both P and Q are true, but Q is not the reason for P.
Which of the following statements about abstract classes in object-oriented programming is true?
Options:
A) An abstract class cannot implement interfaces.
B) An abstract class can be instantiated.
C) An abstract class cannot be subclassed.
D) An abstract class can have both abstract and non-abstract methods. (Correct Answer)
Correct Answer:
An abstract class can have both abstract and non-abstract methods
1 | Function solve(arr, target)
2 | left = 0
3 | right = length(arr) - 1
4 | while left < right
5| sum = arr[left] + arr[right]
6| if sum == target
7| return true
8| else if sum < target
9| left = left + 1
10| else
11| right = right - 1
12| end if
13| end while
14| return false
15| End function solve()
Given arr = [1, 2, 3, 4, 5] and target = 9, what does solve(arr, target) return?
Correct Answer:
true
The function detects that 4 + 5 = 9 and returns true.
What is the basic principle behind Bellman-Ford Algorithm?
Options:
A) Relaxation (Correct Answer)
B) Extrapolation
C) Interpolation
D) Regression
Correct Answer:
Relaxation
If a database uses strict two-phase locking (2PL) for transaction management, what potential
problem must be analyzed and considered?
Options:
A) Decreased query optimization
B) The likelihood of deadlock (Correct Answer)
C) Reduced referential integrity
D) Increased data redundancy
Correct Answer:
The likelihood of deadlock
Consider the schedule:
T1: R(X)
T2: R(X)
T3: W(X)
T2: R(X)
T1: R(Y)
The schedule T1 is:
Options:
A) Conflict, but not view serializable
B) Not conflict and not view serializable
C) Not conflict, but view serializable
D) Conflict and view serializable
et’s carefully analyze the C program shown in the image:
Code:
#include <stdio.h>
int function()
static int num = 8;
return num--;
int main()
for(function(); function(); function())
printf("%d ", function());
return 0;
Correct Answer:
Infinite loop
Which of the following queries displays the sum of all employee salaries for those employees not
making commission, for each job, including only those sums greater than 2500?
select job, sum(sal)
from emp
where comm is null
group by job
having sum(sal) > 2500;
Alright, let’s carefully analyze this pseudocode step by step.
Pseudocode:
1 | Integer[] arr = {1, 2, 3, 4}
2 | Set total = 0
3 | For i = 0 to length(arr) - 1
4 | For j = i to length(arr) - 1
5| total = total + arr[i] + arr[j]
6 | End For
7 | End For
8 | Print total
Correct Output:
50
But the given options in the image are:
• 30
• 20
• 40
• 35
What effect does a context switch have on the state of the process that is being switched out of the
CPU?
Options:
A) It changes from running to terminated
B) It remains in the running state
C) It changes from running to ready
D) It changes from running to waiting
Correct Answer:
It changes from running to ready
Central hub or controller is required by ______ topology.
Options:
A) Star
B) Mesh
C) Ring
D) Bus
Correct Answer:
Star Topology
Let’s carefully analyze the C++ program in the image:
Code (as seen from the image):
#include <iostream>
using namespace std;
class Class1 {
public:
void Display() {
cout << "< 5" << endl;
};
class Class2 {
public:
void Display() { cout << "< 5" << endl;
};
int main() {
Class1 obj1;
obj1.Display();
Class2 obj2;
obj2.Display();
return 0;
Step-by-Step Execution:
1. Class1 obj1; creates an object of Class1.
o obj1.Display(); → prints 5
2. Class2 obj2; creates an object of Class2.
o obj2.Display(); → prints 5
Output:
Correct Answer:
55✔
If an OSPF router should not accept or send OSPF routing updates, but still needs to participate in
OSPF, what configuration should be applied?
Options:
1. ospf disable
2. passive-interface default
3. ospf passive-interface
4. ospf silent-interface
Answer:
ospf passive-interface
If X, Y, and Z are pointer variables of type char, int, and float, respectively in ‘C’ language, then which
of the following statements is true?
Options:
1. Size of X, Y, and Z are same
2. Size of Z is greater than the size of X
3. Size of Y is greater than the size of X
4. Size of Z is greater than the size of Y
Answer:
Size of X, Y, and Z are same
Given items as (value, weight) pairs are: {(40,20), (30,10), (20,5)}.
Considering the capacity of knapsack be 20, find the maximum value assuming items to be divisible.
Options:
1. 60
2. 80
3. 10
4. 40
Answer:
60
In C, how do you declare a pointer variable that can store the address of an integer?
Options:
1. int ptr;
2. int *ptr;
3. ptr int;
4. ptr *int;
Answer:
int *ptr;
Assuming a large dataset of sales records in the Sales table with fields Date, Region, and TotalSales,
how would you apply sorting to get the top 5 highest sales records for the most recent year?
Options:
1. SELECT * FROM Sales WHERE Year(Date) = Year(CURRENT_DATE) ORDER BY TotalSales DESC
LIMIT 5;
2. SELECT TOP 5 * FROM Sales ORDER BY TotalSales DESC;
3. SELECT * FROM Sales WHERE Year(Date) = Year(CURRENT_DATE) ORDER BY Date DESC,
TotalSales DESC LIMIT 5;
4. SELECT * FROM Sales ORDER BY Date DESC, TotalSales DESC LIMIT 5;
Answer:
SELECT * FROM Sales WHERE Year(Date) = Year(CURRENT_DATE) ORDER BY TotalSales DESC
LIMIT 5;
What action should be taken when a transaction requests an intention exclusive (IX) lock on a node
in a database object hierarchy while a sibling node already has a shared (S) lock?
Options:
1. Request the transaction with S lock to downgrade to an IS lock.
2. Escalate the S lock to an IX lock on the parent node.
3. Deny the IX lock, as S and IX on siblings lead to potential conflict.
4. Grant the IX lock, as sibling locks do not conflict.
Answer:
Deny the IX lock, as S and IX on siblings lead to potential conflict.
Consider a relation R (ABCDEFGHIJ) with FD set = { AB → C, A → DE, B → F, F → GH, D → IJ }.
If R is split into ABC, ADE, BF, FGH, DIJ then this decomposition is:
Options:
1. Loss less and dependency preserving
2. Lossy and dependency preserving
3. Loss less and not dependency preserving
4. Lossy and not dependency preserving
Answer:
Loss less and dependency preserving
Which CPU scheduling algorithm can lead to the ‘starvation’ issue for certain processes?
Options:
1. Shortest Remaining Time First
2. Priority Scheduling
3. Round Robin
4. First Come First Serve
Answer:
Priority Scheduling
What will be the output of the following Java code?
class Test {
public static void main(String args[]) {
String s1 = "abc";
String s2 = new String("abc");
System.out.println(s1 == s2);
Options:
1. true
2. false
3. compiler error
Answer:
false
Five jobs A, B, C, D, and E are waiting in Ready Queue. Their expected runtimes are 9, 6, 3, 5, and x
respectively. All jobs entered in Ready queue at time zero. They must run in ______ order to
minimize average response time if 3 < x < 5.
Options:
1. C, B, A, E, D
2. E, D, C, B, A
3. C, E, D, B, A
4. B, A, D, E, C
Answer:
C, E, D, B, A
Which of the following remains same in the header of the packet in a datagram network during the
entire journey of the packet?
Options:
1. Destination address
2. Source address
3. Checksum
4. Padding
Answer:
Source address
What is the time complexity of computing the nth Fibonacci number using recursion?
Options:
1. O(n)
2. O(log n)
3. O(2^n)
4. O(n²)
Answer:
O(2^n)
Generic pointers can be declared with _______.
Options:
1. auto
2. void
3. asm
4. none of the mentioned
Answer:
void
Considering the network layer’s role in handling traffic congestion, which of the following strategies
would be the least effective in a network with a highly dynamic traffic pattern?
Options:
1. Applying Quality of Service (QoS) to prioritize traffic
2. Implementing a static routing protocol
3. Using a dynamic routing protocol that adapts to traffic changes
4. Deploying traffic shaping mechanisms
Answer:
Implementing a static routing protocol
A threaded binary tree is a binary tree in which:
Options:
1. Each node has two children
2. Each node has at most one child
3. Each node is connected to its parent
4. Each node has a thread connecting it to its predecessor or successor
Answer:
Each node has a thread connecting it to its predecessor or successor
Consider the following C function, which one of the following most closely approximates the return
value of the function fun1?
int fun1(int n) {
int i, j, k, p, q = 0;
for (i = 1; i < n; i++) {
p = 0;
for (j = n; j > 1; j = j/2)
p++;
for (k = 1; k < p; k = k*2)
q++;
return q;
Correct Answer:
n * log(log n)
Let’s carefully trace the pseudocode:
1 integer[] arr = [1, 2, 3, 4]
2 set total = 0
3 For i = 0 to length(arr) - 1
4 For j = i to length(arr) - 1
5 total = total + arr[i] * arr[j]
6 End For
7 End For
8 print total
So the printed output is 65, but I see the given options are only 30, 20, 40.
Pseudocode:
1 Integer total = 0
2 for i = 0 to 3
3 for j = 0 to 3
4 if (i - j) mod 4 == 0
5 total = total - 1
6 continue
7 end if
8 total = total + 1
9 end for
10 end for
11 print total
Correct Answer: 8
But your options in the image are:
• 1
• 0
• 4
• -1
"Which SQL keyword is used to return only different values?"
Correct answer: DISTINCT
Analyzing a Priority Scheduling algorithm, you notice that low-priority processes are suffering from
starvation. Which of the following techniques can help alleviate this issue?
Options:
1. Implementing priority donation
2. Decreasing the time quantum
3. Switching to a Shortest Job First algorithm
4. Applying the aging technique
Correct Answer:
4. Applying the aging technique
In a paged memory, the page hit ratio is 0.35; the time to access a page in secondary memory is 100
ns; the time to access a page in primary memory is 10 ns. What is the average access time?
,3.0 ns |
68.0 ns |
68.5 ns
| 78.5 ns
,68.5 ns (correct)
Question: Which of the following statement is correct?
Options:
1. A table can have many primary key and many unique key.
2. A table can have one primary key and one unique key.
3. A table can have one primary key and many unique key.
4. A table can have many primary key and one unique key.
Answer: A table can have one primary key and many unique key.
Question: Which of the following represents necessary conditions for deadlock in operating systems?
Options:
1. Circular wait, Hold and wait, Mutual exclusion, Priority preemption
2. Circular wait, Mutual inclusion, Hold and wait, Scheduled preemption
3. Hold and wait, Mutual inclusion, Preemption, Circular wait
4. Circular wait, Mutual exclusion, No preemption, Hold and wait
Answer: Circular wait, Mutual exclusion, No preemption, Hold and wait
Question: Considering the susceptibility to signal degradation, evaluate the relative performance of
Frequency Division Multiplexing (FDM) versus Time Division Multiplexing (TDM) over long distance
analog transmission.
Options:
1. Neither FDM nor TDM is suitable for long distance analog transmission.
2. Both FDM and TDM are equally susceptible to signal degradation over long distances.
3. TDM is less susceptible to degradation than FDM over long distances.
4. FDM is less susceptible to degradation than TDM over long distances.
Answer: TDM is less susceptible to degradation than FDM over long distances
Assuming a large dataset of sales records in the Sales table with fields Date, Region, and TotalSales,
how would you apply sorting to get the top 5 highest sales records for the most recent year?
Options:
1. SELECT * FROM Sales WHERE Year(Date) = Year(CURRENT_DATE) ORDER BY TotalSales DESC
LIMIT 5;
2. SELECT TOP 5 * FROM Sales ORDER BY TotalSales DESC;
3. SELECT * FROM Sales WHERE Year(Date) = Year(CURRENT_DATE) ORDER BY Date DESC,
TotalSales DESC LIMIT 5;
4. SELECT * FROM Sales ORDER BY Date DESC, TotalSales DESC LIMIT 5;
Correct Answer:
SELECT * FROM Sales WHERE Year(Date) = Year(CURRENT_DATE) ORDER BY Date DESC, TotalSales
DESC LIMIT 5;