Explore topic-wise MCQs in Computer Science.

This section includes 48 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science knowledge and support exam preparation. Choose a topic below to get started.

1.

Consider the following C program. The output of the program is __________. # include int f1(void); int f2(void); int f3(void); int x = 10; int main() { int x = 1; x += f1() + f2() + f3() + f2(); pirntf("%d", x); return 0; } int f1() { int x = 25; x++; return x; } int f2( ) { static int x = 50; x++; return x; } int f3( ) { x *= 10; return x;

A. 230
B. 131
C. 231
D. 330
Answer» B. 131
2.

Language L1 is polynomial time reducible to language L2. Language L3 is polynomial time reducible to L2, which in turn is polynomial time reducible to language L4. Which of the following is/are True? I. If L4 ∈ P, L2 ∈ P II. If L1 ∈ P or L3 ∈ P, then L2 ∈ P III. L1 ∈ P, if and only if L3 ∈ P IV. If L4 ∈ P, then L1 ∈ P and L3 ∈ P

A. II only
B. III only
C. I and IV only
D. I only
Answer» D. I only
3.

Consider the following policies for preventing deadlock in a system with mutually exclusive resources. I. Processes should acquire all their resources at the beginning of execution. If any resource is not available, all resources acquired so far are released. II. The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbers. III. The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbers. IV. The resources are numbered uniquely. A process is allowed to request only for a resource with resource number larger than its currently held resources. Which of the above policies can be used for preventing deadlock?

A. Any one of I and III but not II or IV
B. Any one of I, III and IV but not II
C. Any one of II and III but not I or IV
D. Any one of I, II, III and IV
Answer» E.
4.

Consider the following reservation table for a pipeline having three stages S1, S2 and S3. Time --> ----------------------------- 1 2 3 4 5 ----------------------------- S1 | X | | | | X | S2 | | X | | X | | S3 | | | X | | | The minimum average latency (MAL) is _________

A. 3
B. 2
C. 1
D. 4
Answer» B. 2
5.

Let G be connected undirected graph of 100 vertices and 300 edges. The weight of a minimum spanning tree of G is 500. When the weight of each edge of G is increased by five, the weight of a minimum spanning tree becomes ________.

A. 1000
B. 995
C. 2000
D. 1995
Answer» C. 2000
6.

Consider the following recursive C function. If get(6) function is being called in main() then how many times will the get() function be invoked before returning to the main()? void get (int n) { if (n < 1) return; get(n-1); get(n-3); printf("%d", n);

A. 15
B. 25
C. 35
D. 45
Answer» C. 35
7.

In the network 200.10.11.144/27, the fourth octet (in decimal) of the last IP address of the network which can be assigned to a host is ________

A. 158
B. 255
C. 222
D. 223
Answer» B. 255
8.

Suppose Xi for i = 1, 2, 3 are independent and identically distributed random variables whose probability mass functions are Pr[Xi = 0] = Pr[Xi = 1] = 1/2 for i = 1, 2, 3. Define another random variable Y = X1 X2 ⊕ X3, where ⊕ denotes XOR. Then Pr[Y = 0 ⎪ X3 = 0] = ____________.

A. 0.75
B. 0.50
C. 0.85
D. 0.25
Answer» B. 0.50
9.

Since it is a network that uses switch, every packet goes through two links, one from source to switch and other from switch to destination. Since there are 10000 bits and packet size is 5000, two packets are sent. Transmission time for each packet is 5000 / 1077 bits per second links. Each link has a propagation delay of 20 microseconds. The switch begins forwarding a packet 35 microseconds after it receives the same. If 10000 bits of data are to be transmitted between the two hosts using a packet size of 5000 bits, the time elapsed between the transmission of the first bit of data and the reception of the last bit of the data in microseconds is _________.

A. 1075
B. 1575
C. 2220
D. 2200
Answer» C. 2220
10.

Consider the equation (43)x = (y3)8 where x and y are unknown. The number of possible solutions is ________.

A. 3
B. 4
C. 5
D. 6
Answer» D. 6
11.

For the processes listed in the following table, which of the following scheduling schemes will give the lowest average turnaround time? Process Arrival Time Processing Time A 0 3 B 1 6 C 4 4 D 6 2

A. First Come First Serve
B. Non-preemptive Shortest Job First
C. Shortest Remaining Time
D. Round Robin with Quantum value two
Answer» D. Round Robin with Quantum value two
12.

If the following system has non-trivial solution, px + qy + rz = 0 qx + ry + pz = 0 rx + py + qz = 0 then which one of the following options is True?

A. p – q + r = 0 or p = q = –r
B. p + q – r = 0 or p = –q = r
C. p + q + r = 0 or p = q = r
D. p – q + r = 0 or p = –q = –r
Answer» D. p – q + r = 0 or p = –q = –r
13.

Which of the following languages are context-free? L1 = {ambnanbm ⎪ m, n ≥ 1} L2 = {ambnambn ⎪ m, n ≥ 1} L3 = {ambn ⎪ m = 2n + 1}

A. L1 and L2 only
B. L1 and L3 only
C. L2 and L3 only
D. L3 only
Answer» C. L2 and L3 only
14.

Consider the following grammar G. S → F ⎪ H F → p ⎪ c H → d ⎪ c Where S, F and H are non-terminal symbols, p, d and c are terminal symbols. Which of the following statement(s) is/are correct? S1: LL(1) can parse all strings that are generated using grammar G. S2: LR(1) can parse all strings that are generated using grammar G.

A. Only S1
B. Only S2
C. Both S1 and S2
D. Neither S1 and S2
Answer» E.
15.

Consider the following two C code segments. Y and X are one and two dimensional arrays of size n and n × n respectively, where 2 ≤ n ≤ 10. Assume that in both code segments, elements of Y are initialized to 0 and each element X[i][j] of array X is initialized to i + j. Further assume that when stored in main memory all elements of X are in same main memory page frame. Code segment 1: // initialize elements of Y to 0 // initialize elements X[i][j] of X to i+j for (i = 0; i < n; i++) y[i] + = X[0][i]; Code segment 2: // initialize elements of Y to 0 // initialize elements X[i][j] of X to i+j for (i = 0; i < n; i++) y[i] + = X[i][0]; Which of the following statements is/are correct? S1: Final contents of array Y will be same in both code segments. S2: Elements of array X accessed inside the for loop shown in code segment 1 are contiguous in main memory. S3: Elements of array X accessed inside the for loop shown in code segment 2 are contiguous in main memory.

A. Only S2 is correct
B. Only S3 is correct
C. Only S1 and S2 are correct
D. Only S1 and S3 are correct
Answer» D. Only S1 and S3 are correct
16.

Consider a network connecting two systems located 8000 kilometers apart. The bandwidth of the network is 500 × 106 bits per second. The propagation speed of the media is 4 × 106 meters per second. It is needed to design a Go-Back-N sliding window protocol for this network. The average packet size is 107 bits. The network is to be used to its full capacity. Assume that processing delays at nodes are negligible. Then, the minimum size in bits of he sequence number field has to be ________.

A. 2
B. 4
C. 8
D. 16
Answer» D. 16
17.

Assume that a mergesort algorithm in the worst case takes 30 seconds for an input of size 64. Which of the following most closely approximates the maximum input size of a problem that can be solved in 6 minutes?

A. 256
B. 512
C. 1024
D. 2048
Answer» B. 512
18.

Consider the following C program. # include int main( ) { static int a[] = {10, 20, 30, 40, 50}; static int *p[] = {a, a+3, a+4, a+1, a+2}; int **ptr = p; ptr++; printf("%d%d", ptr - p, **ptr}; } The output of the program is _________

A. 140
B. 120
C. 100
D. 40
Answer» B. 120
19.

Consider a binary tree T that has 200 leaf nodes. Then, the number of nodes in T that have exactly two children are _________.

A. 199
B. 200
C. Any number between 0 and 199
D. Any number between 100 and 200
Answer» B. 200
20.

In a room there are only two types of people, namely Type 1 and Type 2. Type 1 people always tell the truth and Type 2 people always lie. You give a fair coin to a person in that room, without knowing which type he is from and tell him to toss it and hide the result from you till you ask for it. Upon asking, the person replies the following: “The result of the toss is head if and only if I am telling the truth.” Which of the following options is correct?

A. The result is head
B. The result is tail
C. If the person is of Type 2, then the result is tail
D. If the person is of Type 1, then the result is tai
Answer» B. The result is tail
21.

Consider the following statements. I. TCP connections are full duplex. II. TCP has no option for selective acknowledgment III. TCP connections are message streams.

A. Only I is correct
B. Only I and II are correct
C. Only II and III are correct
D. All of I, II and III are correct
Answer» B. Only I and II are correct
22.

Consider a software project with the following information domain characteristic for calculation of function point metric. Number of external inputs (I) = 30 Number of external output (O) = 60 Number of external inquiries (E) = 23 Number of files (F) = 08 Number of external interfaces (N) = 02 It is given that the complexity weighting factors for I, O, E, F and N are 4, 5, 4, 10 and 7, respectively. It is also given that, out of fourteen value adjustment factors that influence the development effort, four factors are not applicable, each of he other four factors have value 3, and each of the remaining factors have value 4. The computed value of function point metric is ____________

A. 612.06
B. 212.05
C. 305.09
D. 806.9
Answer» B. 212.05
23.

Consider the relation X(P, Q, R, S, T, U) with the following set of functional dependencies F = { {P, R} → {S,T}, {P, S, U} → {Q, R} } Which of the following is the trivial functional dependency in F+ is closure of F

A. {P,R}→{S,T}
B. {P,R}→{R,T
C. {P,S}→{S}
D. {P,S,U}→{Q
Answer» D. {P,S,U}→{Q
24.

Consider the following array of elements. 〈89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100〉. The minimum number of interchanges needed to convert it into a max-heap is

A. 4
B. 5
C. 2
D. 3
Answer» E.
25.

Let T be the language represented by the regular expression Σ∗0011Σ∗ where Σ = {0, 1}. What is the minimum number of states in a DFA that recognizes L' (complement of L)

A. 4
B. 5
C. 6
D. 8
Answer» C. 6
26.

Given a hash table T with 25 slots that stores 2000 elements, the load factor α for T is

A. 80
B. 0.0125
C. 8000
D. 1.25
Answer» B. 0.0125
27.

Among simple LR (SLR), canonical LR, and look-ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful, in that order?

A. SLR, LALR
B. Canonical LR, LALR
C. SLR, canonical LR
D. LALR, canonical LR
Answer» D. LALR, canonical LR
28.

Consider a machine with a byte addressable main memory of 220 bytes, block size of 16 bytes and a direct mapped cache having 212 cache lines. Let the addresses of two consecutive bytes in main memory be (E201F)16 and (E2020)16. What are the tag and cache line address (in hex) for main memory address (E201F)16?

A. E, 201
B. F, 201
C. E, E20
D. 2, 01F
Answer» B. F, 201
29.

While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is

A. 65
B. 67
C. 69
D. 83
Answer» C. 69
30.

The result evaluating the postfix expression 10 5 + 60 6 / * 8 – is

A. 284
B. 213
C. 142
D. 71
Answer» D. 71
31.

Consider a software program that is artificially seeded with 100 faults. While testing this program, 159 faults are detected, out of which 75 faults are from those artificially seeded faults. Assuming that both real and seeded faults are of same nature and have same distribution, the estimated number of undetected real faults is ____________.

A. 28
B. 175
C. 56
D. 84
Answer» B. 175
32.

Two processes X and Y need to access a critical section. Consider the following synchronization construct used by both the processes. Q20 Here, varP and varQ are shared variables and both are initialized to false. Which one of the following statements is true?

A. The proposed solution prevents deadlock but fails to guarantee mutual exclusion
B. The proposed solution guarantees mutual exclusion but fails to prevent deadlock
C. The proposed solution guarantees mutual exclusion and prevents deadlock
D. The proposed solution fails to prevent deadlock and fails to guarantee mutual exclusion
Answer» B. The proposed solution guarantees mutual exclusion but fails to prevent deadlock
33.

In a web server, ten WebPages are stored with the URLs of the form http://www.yourname.com/var.html; where, var is a different number from 1 to 10 for each Webpage. Suppose, the client stores the Webpage with var = 1 (say W1) in local machine, edits and then tests. Rest of the WebPages remains on the web server. W1 contains several relative URLs of the form “var.html” referring to the other WebPages. Which one of the following statements needs to be added in W1, so that all the relative URLs in W1 refer to the appropriate WebPages on the web server?

A. <a.href: “http://www.yourname.com/”, href: “...var.html”>
B. <base href: “http://www.yourname.com/”>
C. <a.href: “http://www.yourname.com/”>
D. <base href: “http://www.yourname.com/”, range: “...var.html”>
Answer» C. <a.href: “http://www.yourname.com/”>
34.

Consider the following C program segment. # include int main( ) { char s1[7] = "1234", *p; p = s1 + 2; *p = '0' ; printf ("%s", s1); } What will be printed by the program?

A. 12
B. 120400
C. 1204
D. 1034
Answer» D. 1034
35.

Consider a CSMA/CD network that transmits data at a rate of 100 Mbps (108 bits per second) over a 1 km (kilometer) cable with no repeaters. If the minimum frame size required for this network is 1250 bytes, what is the signal speed (km/sec) in the cable?

A. 8000
B. 10000
C. 16000
D. 20000
Answer» E.
36.

The number of 4 digit numbers having their digits in non-decreasing order (from left to right) constructed by using the digits belonging to the set {1, 2, 3} is ___

A. 12
B. 13
C. 14
D. 15
Answer» E.
37.

Q13 The equality above remains correct if X is replace by A

A. Only I
B. Only II
C. I or III or IV but not II
D. II or III or IV but not I
Answer» D. II or III or IV but not I
38.

Consider the following relation Cinema (theater, address, capacity) Which of the following options will be needed at the end of the SQL query SELECT P1. address FROM Cinema P1 Such that it always finds the addresses of theaters with maximum capacity?

A. WHERE P1. Capacity> = All (select P2. Capacity from Cinema P2)
B. WHERE P1. Capacity> = Any (select P2. Capacity from Cinema P2)
C. WHERE P1. Capacity > All (select max(P2. Capacity) from Cinema P2)
D. WHERE P1. Capacity > Any (select max (P2. Capacity) from Cinema P2
Answer» B. WHERE P1. Capacity> = Any (select P2. Capacity from Cinema P2)
39.

Let # be a binary operator defined as X # Y = X′ + Y′ where X and Y are Boolean variables. Consider the following two statements. S1: (P # Q) # R = P # (Q # R) S2: Q # R = R # Q Which of the following is/are true for the Boolean variables P, Q and R?

A. Only S1 is True
B. Only S2 is True
C. Both S1 and S2 are True
D. Neither S1 nor S2 are True
Answer» C. Both S1 and S2 are True
40.

The maximum number of processes that can be in Ready state for a computer system with n CPUs is

A. n
B. n2
C. 2n
D. Independent of n
Answer» E.
41.

Most experts feel that in spite of possessing all the technical skills required to be a batsman of the highest order, he is unlikely to be so due to lack of requisite temperament. He was guilty of throwing away his wicket several times after working hard to lay a strong foundation. His critics pointed out that until he addressed this problem, success at the highest level will continue to elude him. Which of the statements(s) below is/are logically valid and can be inferred from the above passage? (i) He was already a successful batsman at the highest level. (ii) He has to improve his temperament in order to become a great batsman. (iii) He failed to make many of his good starts count. (iv) Improving his technical skills will guarantee success.

A. (iii) and (iv
B. (ii) and (iii)
C. (i), (ii) and (iii)
D. ii) only
Answer» C. (i), (ii) and (iii)
42.

The head of a newly formed government desires to appoint five of the six selected members P, Q, R, S, T and U to portfolios of Home, Power, Defence, Telecom, and Finance. U does not want any portfolio if S gets one of the five. R wants either Home or Finance or no portfolio. Q says that if S gets either Power of telecom, then she must get the other one. T insists on a portfolio if P gets one Which is the valid distribution of portfolios?

A. P-Home, Q-Power, R-Defence, S-Telecom, T-Finance
B. R-Home, S-Power, P-Defence, Q-Telecom, T-Finance
C. P-Home, Q-Power, T-Defence, S-Telecom, U-Finance
D. Q-Home, U-Power, T-Defence, R-Telecom, P-Finance
Answer» C. P-Home, Q-Power, T-Defence, S-Telecom, U-Finance
43.

Alexander turned his attention towards India, since he had conquered Persia. Which one of the statements below is logically valid and can be inferred from the above sentence?

A. Alexander would not have turned his attention towards India had he not conquered Persia
B. Alexander was not ready to rest on his laurels, and wanted to march to India
C. Alexander was completely in control of his army and could command it to move towards India.
D. Since Alexander’s kingdom extended to India borders after the conquest of Persia, he was keen to move further
Answer» B. Alexander was not ready to rest on his laurels, and wanted to march to India
44.

A function f(x) is linear and has a value of 29 at x = –2 and 39 at x = 3. Find its value at x = 5.

A. 59
B. 45
C. 43
D. 35
Answer» D. 35
45.

Select the pair that best expresses a relationship similar to that expressed in the pair: Children : Pediatrician

A. Adult : Orthopaedist
B. Females : Gynaecologist
C. Kidney : Nephrologist
D. Skin : Dermatologist
Answer» C. Kidney : Nephrologist
46.

Extreme focus on syllabus and studying for tests has become such a dominant concern of Indian students that they close their minds to anything ________ to the requirements of the exam.

A. related
B. extraneous
C. outside
D. useful
Answer» C. outside
47.

The Tamil version of ________ John Abraham-starrer Madras Cafe _____ cleared by the Censor Board with no cuts last week, but the film’s distributors ______ no takers among the exhibitors for a release in Tamil Nadu _________ this Friday.

A. Mr., was, found, on
B. a, was, found, at
C. the, was, found, on
D. a, being, find at
Answer» D. a, being, find at
48.

If ROAD is written as URDG, then SWAN should be written as:

A. VXDQ
B. VZDQ
C. VZDP
D. UXDQ
Answer» C. VZDP