Computer Science MCQs | Computer Science Multiple Choice Questions with Answers

Questions
1 A technique used to approximate halftones without reducing spatial resolution is known as _________.
A Halftoning
B Dithering
C Error diffusion
D None of the above

Answer: Option [B]
2 Consider a triangle represented by A(0, 0), B(1, 1), C(5, 2). The triangle is rotated by 45 degrees about a point P(–1, –1). The co-ordinates of the new triangle obtained after rotation shall be _______
A A' ( ) –1, 2 – 1 , B'( ) –1, 2 2 – 1 , C'     3 2 2 – 1 , 9 2 2 – 1
B A' ( ) 2 – 1, –1 , B'( ) 2 2 – 1, –1 , C'     3 2 2 – 1 , 9 2 2 – 1
C A' ( ) –1, 2 – 1 , B'( ) 2 2 – 1, –1 , C'     3 2 2 – 1 , 9 2 2 – 1
D A' ( ) –1, 2 – 1 , B'( ) 2 2 – 1, –1 , C'     9 2 2 – 1 , 3 2 2 – 1

Answer: Option [A]
3 In Cyrus-Beck algorithm for line clipping the value of t parameter is computed by the relation : (Here P1 and P2 are the two end points of the line, f is a point on the boundary, n1 is inner normal)
A (P1 – fi) ⋅ ni (P2 – P1) ⋅ ni
B (fi – P1) ⋅ ni (P2 – P1) ⋅ ni
C (P2 – fi) ⋅ ni (P1 – P2) ⋅ ni
D (fi – P2) ⋅ ni (P1 – P2) ⋅ ni

Answer: Option [B]
4 Which one of the following is used to compute cyclomatic complexity ?
A The number of regions – 1
B E – N + 1, where E is the number of flow graph edges and N is the number of flow graph nodes
C P – 1, where P is the number of predicate nodes in the flow graph G
D P + 1, where P is the number of predicate nodes in the flow graph G

Answer: Option [C]
5 Consider the following statements S1, S2 and S3 : S1 : In call-by-value, anything that is passed into a function call is unchanged in the caller’s scope when the function returns. S2 : In call-by-reference, a function receives implicit reference to a variable used as argument. S3 : In call-by-reference, caller is unable to see the modified variable used as argument.
A S3 and S2 are true
B S3 and S1 are true
C S2 and S1 are true
D S1, S2, S3 are true

Answer: Option [A]
6 How many tokens will be generated by the scanner for the following statement ? x = x ∗ (a + b) – 5;
A 12
B 11
C 10
D 07

Answer: Option [C]
7 Which of the following statements is not true ?
A MPI_Isend and MPI_Irecv are non-blocking message passing routines of MPI
B MPI_Issend and MPI_Ibsend are non-blocking message passing routines of MPI
C MPI_Send and MPI_Recv are non-blocking message passing routines of MPI
D MPI_Ssend and MPI_Bsend are blocking message passing routines of MPI

Answer: Option [B]
8 The pushdown automation M = ({q0, q1, q2}, {a, b}, {0, 1}, δ, q0, 0, {q0}) with δ(q0, a, 0) = {(q1, 10)} δ(q1, a, 1) = {(q1, 11)} δ(q1, b, 1) = {(q2, λ)} δ(q2, b, 1) = {(q2, λ)} δ(q2, λ, 0) = {(q0, λ)} Accepts the language
A L = {an bm | n, m ≥ 0}
B Inventory
C L = {an bn | n ≥ 0} (C) L = {an bm | n, m > 0}
D L = {an bn | n > 0}

Answer: Option [D]
9 Given two languages : L1 = {(ab)n ak | n > k, k ≥ 0} L2 = {an bm | n ≠ m} Using pumping lemma for regular language, it can be shown that
A L1 is regular and L2 is not regular
B L1 is not regular and L2 is regular
C L1 is regular and L2 is regular
D L1 is not regular and L2 is not regular

Answer: Option [D]
10 Regular expression for the complement of language L = {an bm | n ≥ 4, m ≤ 3} is
A (a + b)* ba(a + b)*
B a* bbbbb*
C (λ + a + aa + aaa)b* + (a + b)* ba(a + b)*
D None of the above

Answer: Option [D]
11 For n devices in a network, ________ number of duplex-mode links are required for a mesh topology.
A n(n + 1)
B n (n – 1)
C n(n + 1)/2
D n(n – 1)/2

Answer: Option [B]
12 How many characters per second (7 bits + 1 parity) can be transmitted over a 3200 bps line if the transfer is asynchronous ? (Assuming 1 start bit and 1 stop bit)
A 300
B 320
C 360
D 400

Answer: Option [B]
13 Which of the following is not a field in TCP header ?
A Sequence number
B Fragment offset
C Checksum
D Window size

Answer: Option [Z]
14 What is the propagation time if the distance between the two points is 48,000 ? Assume the propagation speed to be 2.4 × 108 metre/second in cable.
A 0.5 ms
B 20 ms
C 50 ms
D 200 ms

Answer: Option [B]
15 __________ is a bit-oriented protocol for communication over point-to-point and multipoint links.
A Stop-and-wait
B HDLC
C Sliding window
D Go-back-N

Answer: Option [A]
16 Which one of the following is true for asymmetric-key cryptography ?
A Private key is kept by the receiver and public key is announced to the public
B Public key is kept by the receiver and private key is announced to the public
C Both private key and public key are kept by the receiver
D Both private key and public key are announced to the public

Answer: Option [C]
17 Any decision tree that sorts n elements has height
A Ω(n)
B Ω(lgn)
C Ω(nlgn)
D Ω(n2)

Answer: Option [D]
18 We can show that the clique problem is NP-hard by proving that
A CLIQUE ≤ P 3-CNF_SAT
B CLIQUE ≤ P VERTEX_COVER
C CLIQUE ≤ P SUBSET_SUM
D None of the above

Answer: Option [C]
19 Dijkstra algorithm, which solves the single-source shortest--paths problem, is a _________, and the Floyd-Warshall algorithm, which finds shortest paths between all pairs of vertices, is a _________
A Greedy algorithm, Divide-conquer algorithm
B Divide-conquer algorithm, Greedy algorithm
C Greedy algorithm, Dynamic programming algorithm
D Dynamic programming algorithm, Greedy algorithm

Answer: Option [B]
20 Consider the problem of a chain of three matrices. Suppose that the dimensions of the matrices are 10 × 100, 100 × 5 and 5 × 50 respectively. There are two different ways of parenthesization : (i) ((A1 A2)A3) and (ii) (A1(A2 A3)). Computing the product according to the first parenthesization is ________ times faster in comparison to the second parenthesization.
A 5
B 10
C 20
D 100

Answer: Option [B]