Documente Academic
Documente Profesional
Documente Cultură
Programming Questions:
The function accepts 3 integer a,b,c as its argument which are sides of a triangle. Implement the
function to calculate the area of triangle and return the square of are.
Note:
Example:
Input: a: 5 b: 4 c: 3
Output: 36
The function accepts three integers h hardness of steel, c carbon content in steel and ts tensile
strength of steel as its argument. Implement the function to classify the steel according to the
following rules:
● If all three conditions are satisfied, then the steel is of class ‘A’.
● If condition 1 and 2 are satisfied, then the steel is of class ‘B’.
● If condition 1 and 3 are satisfied, then the steel is of class ‘C’.
● If condition 2 and 3 are satisfied, then the steel is of class ‘D’.
● If only condition is satisfied, then the steel is of class ‘E’.
● If none of three conditions are satisfied, then the steel is of class ‘F’.
Example:
Input: h: 70 c: 0.9 ts: 5800
Output: A
Objective Questions:
1. Consider a situation when ‘p’ processes share ‘r’ resources of the same type. The maximum
requirement of each process doesn’t known, their maximum requirement is always less than
p+r. In such situation deadlock:
A) has to occur
B) can never occur
C) none of the mentioned options
D) may occur
2. Which of the following statements is true about storage class of variable?
1) It tells us where the variable is to be stored.
2) It tells us about the initial value of the variable.
3) It tells us about the scope of the variable.
4) It tells us about the life of variable.
Choose the correct answer from the options given below.
A) Only 2 and 4
B) Only 1, 2 and 3
C) All 1,2,3 and 4
D) Only 1 and 2
3. Which of the following is a legal declaration of Floating-point literal in C++?
A) 510E
B) 210f
C) .e55
D) 314159E-5L
4. At least how many 2-input NAND gates are required to implement the given function?
F = (a’+b’)(c+d)
A) 6
B) 3
C) 5
D) 4
5. Suppose we are given two strings, where one is pattern(P) and the other is text(T) and we
have to find the number of occurrences of P in T using the Brute-force solution. Which of the
following options is the correct time complexity for the execution of the solution?
A) None of the mentioned options
B) O(P)
C) O(|P|.|T|)
D) O(T)
6. Which of the following is the correct algorithm for implementing a leaky bucket algorithm if
the traffic consists of variable-length packets?
A) 1. Initialize a counter to n-1 at the tick of the clock.
2. If n < the size of the packet, send the packet and decrement the counter by the packet size.
Repeat this step until n is equal to the packet size.
3. Reset the counter and go to step 1.
2. If n > the size of the packet, send the packet and decrement the counter by the packet size.
Repeat this step until n is smaller than the packet size.
3. Reset the counter and go to step 1.
2. If n > the size of the packet, send the packet and decrement the counter by the packet size.
Repeat this step until n is equal to the packet size.
3. Reset the counter and go to step 1.
7. For which of the following purposes, FTP uses well-known TCP port 21?
A) Data Control Process
B) Server Control Process
C) Control Connection
D) Data Connection
8. Which of the following statements is TRUE regarding a simple connected undirected graph
with more than 2 vertices?
A) At least two vertices have the same degree.
B) At least three vertices have the same degree.
C) All the vertices have the same degree.
D) No two vertices have the same degree.
9. What is the maximum number of spanning trees that the complete undirected graph with n
nodes have?
A) n
B) nn-1
C) nn-2
D) nn
10. Let A(p, q, r) and B(s, t, u) be two relations in which s is the foreign key of B that refers to
the primary key of A. Now, if we want to perform the following four operations, then which
of the following is true about the referential integrity constraint?
1) Insert into A
2) Insert into B
3) Delete from A
4) Delete from B
A) None of them will cause a violation
B) Operation 1 and 3 will cause a violation
C) Operation 2 and 3 will cause a violation
D) All of them will cause violation
11. In C language, which of the following can not be a character literal?
A) Plain character
B) None of the mentioned options
C) Universal character
D) Escape sequence
12. In which of the following tier of 3-tier architecture, the end users are operated on?
A) Data tier
B) Presentation Tier
C) Middle Tier
D) Application Tier
13. Which of the following problems can be solved by Dijkstra’s banking algorithm in an
operating system?
A) Deadlock recovery
B) Mutual Exclusion
C) Deadlock Avoidance
D) Context switching
14. Which of the following statements is correct about flooding?
1. Flooding always selects the shortest path.
2. In selective flooding, the packets are sent to those lines that are going approximately in
the right direction
A) Q canonically covers P
B) Both P and Q canonically covers each other
C) P canonically covers Q
D) None of them canonically covers each other
28. The concept of hierarchical classification is supported by _________
A) Encapsulation
B) Inheritance
C) Abstraction
D) Polymorphism
29. Consider the following statements:
1. As the number of entries in the hash table increases, the number of collision increase
2. The worst time complexity of quicksort is O(n2).
3. Binary Search implemented using a linked list is efficient.
4. A real-world example of queue can be a two-way single road.
A) Only 2, 3 and 4
B) Only 1 and 2
C) Only 1 and 4
D) All 1, 2, 3 and 4
30. What is the maximum data rate of a channel for a noiseless 5-kHz binary channel?
A) 10000bps
B) 6000bps
C) 2500bps
D) 5000bps
31. What will be the output of the following pseudocode for a=5, b=10?
int c = a - b
for i = 1 to 4
c = c-a
for j = 3 to i
a = a+i
c = c+a+j
end for
end for
print c
A. 393
B. None of the mentioned option
C. 92
D. 18
32. What will be the output of the following code?
#include<iostream>
Answers: 1 (d) 2 (c) 3(d) 4(d) 5(d) 6(e) 7(c) 8(a) 9(c) 10(c) 11(b) 12(b) 13(c) 14(b) 15(b) 16(c) 17 (b)
18(d) 19 (a) 20(c) 21(d) 22(b) 23(d) 24(c) 25(c) 26(c) 27(b) 28(d) 29(b) 30(a) 31(d) 32(b) 33(c)
34(a) 35(d) 36(c) 37(a) 38(a) 39(c)