DSSSB TGT / PGT · Computer Science

Algorithms Previous Year Questions (page 2)

65 Algorithms (Computer Science) questions asked in DSSSB TGT / PGT previous year papers, each with the correct answer and explanation. Read them free on UTpaper, or attempt the full papers as timed online tests.

  • 65 questions
  • Official answer key
  • Free

Other Computer Science topics

Q51DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)
Which of the following is NOT the application of Divide and Conquer?
  1. ABinary Search
  2. BAll Pairs Shortest Path Problem
  3. CQuick Sort
  4. DStrassen's Matrix Multiplication
Show answerHide answer

Correct answer: (B) All Pairs Shortest Path Problem

Explanation

All-pairs shortest path (Floyd-Warshall) is solved by dynamic programming. Binary search, quick sort and Strassen's multiplication are divide and conquer algorithms.

Q52DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)
Which of the following is a clipping algorithm?
  1. ASimple DDA
  2. BLiang Barsky's algorithm
  3. CBresenham's algorithm
  4. DMid-point Algorithm
Show answerHide answer

Correct answer: (B) Liang Barsky's algorithm

Explanation

Liang-Barsky is a parametric line-clipping algorithm. DDA, Bresenham and the mid-point algorithm are line or circle drawing algorithms.

Q53DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)
Which of the following is the easiest to be transformed into a computer program?
  1. APseudo-code
  2. BAlgorithm
  3. CFlowchart
  4. DNone of the above
Show answerHide answer

Correct answer: (A) Pseudo-code

Explanation

Pseudo-code is already written in structured, code-like statements, so it is the easiest to turn directly into a program.

Q54DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)
Arrange the following in the order of growth. O(n), O(n²), O(2ⁿ), O(log n), O(n log n), O(n² log n)
  1. AO(n), O(n²), O(log n), O(2ⁿ), O(n log n), O(n² log n)
  2. BO(n), O(2ⁿ), O(2ⁿ), O(log n), O(n² log n), O(n log n)
  3. CO(log n), O(n), O(n log n), O(n²), O(n² log n), O(2ⁿ)
  4. DO(n²), O(n), O(2ⁿ), O(log n), O(n log n), O(n² log n)
Show answerHide answer

Correct answer: (C) O(log n), O(n), O(n log n), O(n²), O(n² log n), O(2ⁿ)

Explanation

Growth order: log n < n < n log n < n² < n² log n < 2ⁿ. Exponential growth is the fastest.

Q55DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)
Grep command is used to:
  1. Achange the case of alphabets
  2. Bsearch for a specific pattern from a specified file and display those lines containing the pattern
  3. Ccut the columns fields of a specified file
  4. Dredirect the output of one command to another command
Show answerHide answer

Correct answer: (B) search for a specific pattern from a specified file and display those lines containing the pattern

Explanation

grep (global regular expression print) searches files for a pattern and prints the matching lines. tr changes case, cut extracts columns, and a pipe redirects output.

Q56DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)
Which of these is NOT a parameter upon which the influence of lightning is based?
  1. ALight Source
  2. BPosition of Observer
  3. CRendering Algorithm
  4. DSurface
Show answerHide answer

Correct answer: (C) Rendering Algorithm

Explanation

The effect of lighting depends on the light source, the surface's properties and the observer's position. The rendering algorithm is a technique for drawing the scene, not a lighting parameter.

Q57DSSSB TGT Computer Science, 24 Jun 2023, Shift 3 (4:30 PM)
Which of the following is NOT a symmetric-key cryptographic algorithm?
  1. AAES
  2. BRC4
  3. CRSA
  4. DDES
Show answerHide answer

Correct answer: (C) RSA

Explanation

RSA is an asymmetric (public-key) algorithm. AES, DES and RC4 are symmetric-key algorithms.

Q58DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
The time complexity of a quick soft algorithm which makes use of a median, found by an O(n) algorithm, as pivot element is:
  1. AO(n³)
  2. BO(n log n)
  3. CO(n²)
  4. DO(n)
Show answerHide answer

Correct answer: (B) O(n log n)

Explanation

If the median is used as pivot, every split is exactly balanced: T(n) = 2T(n/2) + O(n), which gives O(n log n) even in the worst case.

Q59DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
An algorithm that always runs in polynomial time but possibly returns erroneous answers is called a/an ______.
  1. Aapproximation algorithm
  2. BMonte Carlo algorithm
  3. CAtlantic City algorithm
  4. DLas Vegas algorithm
Show answerHide answer

Correct answer: (B) Monte Carlo algorithm

Explanation

A Monte Carlo algorithm has a fixed (polynomial) running time but may give a wrong answer with small probability. A Las Vegas algorithm is always correct, but its running time varies.

Q60DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
In RSA algorithm, if p = 7, q = 11 and d = 37, then what will be the value of e?
  1. A15
  2. B17
  3. C13
  4. D11
Show answerHide answer

Correct answer: (C) 13

Explanation

n = 77 and φ(n) = 6 × 10 = 60. e must satisfy e × 37 ≡ 1 (mod 60). Since 13 × 37 = 481 = 8 × 60 + 1, e = 13.

Q61DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
Which of the following is easier to be transformed into a computer program?
  1. ANone of the given options
  2. BPseudo code
  3. CAlgorithm
  4. DFlow chart
Show answerHide answer

Correct answer: (B) Pseudo code

Explanation

Pseudocode is already close to the structure of a programming language, so it is the easiest form to turn into actual code.

Q62DSSSB TGT Computer Science, 25 Jun 2023, Shift 3 (4:30 PM)
What is the purpose of a software design pattern in software engineering?
  1. ATo increase the complexity of the software design
  2. BTo make the software design more rigid and resistant to change
  3. CTo provide a standard solution to a common problem in software design
  4. DTo make the software design more flexible and adaptable to change
Show answerHide answer

Correct answer: (C) To provide a standard solution to a common problem in software design

Explanation

A design pattern (such as Singleton or Observer) is a reusable, standard solution to a common software design problem.

Q63DSSSB TGT Computer Science, 25 Jun 2023, Shift 2 (12:30 PM)
What is the best case and worst-case complexity of selection sort?
  1. AO(n log n)
  2. BO(n)
  3. CO(n²)
  4. DO(log n)
Show answerHide answer

Correct answer: (C) O(n²)

Explanation

Selection sort always scans the whole unsorted part to find the minimum, making about n(n−1)/2 comparisons whatever the input order. So both its best and worst cases are O(n²).

Q64DSSSB TGT Computer Science, 25 Jun 2023, Shift 2 (12:30 PM)
Which of the following algorithm design techniques is used in the merge sort algorithm?
  1. AGreedy algorithm
  2. BBacktracking
  3. CDivide and conquer
  4. DDivide and conquer, backtracking and greedy algorithm
Show answerHide answer

Correct answer: (C) Divide and conquer

Explanation

Merge sort uses divide and conquer: it splits the array into halves, sorts each half recursively and then merges the two sorted halves.

Q65DSSSB TGT Computer Science, 25 Jun 2023, Shift 2 (12:30 PM)
What is the average case time complexity of merge sort?
  1. AO(n log n)
  2. BO(n)
  3. CO(1)
  4. DO(n² log n)
Show answerHide answer

Correct answer: (A) O(n log n)

Explanation

Merge sort always halves the array (log n levels) and does O(n) merging work at each level. So its best, average and worst case are all O(n log n).

How to use these DSSSB TGT / PGT Computer Science questions

Every question here was asked in a real DSSSB TGT / PGT paper; the paper and shift are shown on the card, and the number opens the question on its own page. Try each one before tapping Show answer, then attempt the full DSSSB TGT / PGT papers as timed tests to check your speed under exam conditions.

More DSSSB TGT / PGT subjects