DSSSB TGT / PGT · Topic-wise previous year questions
Computer Science Previous Year Questions
1995 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.
Name the tag and the attribute to be used to change the sequence of the list items in an ordered list from numbers to upper case letters
ATag-<OL>, Attribute - START
BTag-<OL>, Attribute - VALUE
CTag-<OL>, Attribute - TYPE
DTag-<OL>, Attribute - CASE
Show answerHide answer
Correct answer: (C) Tag-<OL>, Attribute - TYPE
Explanation
The TYPE attribute of <OL> sets the numbering style; TYPE="A" gives upper-case letters (A, B, C...). START only sets the starting value, and VALUE belongs to <LI>.
Which of the following file stream function will move the file pointer to Nth record in a binary file F created with the help of objects of class EMP?
AF.tellg(N)
BF.seekp(N)
CF.seekp((N−1)* sizeof(EMP))
DF.seekp(sizeof(EMP)/N)
Show answerHide answer
Correct answer: (C) F.seekp((N−1)* sizeof(EMP))
Explanation
Records are stored one after another, so the Nth record begins after N−1 records, at byte offset (N−1)*sizeof(EMP). seekp() moves the put pointer there; tellg() only reports the current position.
ALinked allocation of disk space allows only sequential access of data.
BIndexed allocation of disk space allows direct access to disk blocks.
CThere is no internal fragmentation in contiguous allocation of disk space.
DThere is no external fragmentation in linked allocation of disk space.
Show answerHide answer
Correct answer: (C) There is no internal fragmentation in contiguous allocation of disk space.
Explanation
Contiguous allocation does suffer internal fragmentation, since a file's last block is usually only partly filled; its main problem is external fragmentation. The other three statements are correct.
Consider the following statements about deadlock:
A. Existence of a cycle in resource-allocation graph indicates deadlock.
B. Existence of a cycle in wait-for graph indicates deadlock.
C. Mutual-exclusion, hold and wait, no preemption and circular wait conditions, if occur simultaneously, may lead to deadlock.
Mark the correct option :
AOnly (b) is correct
BOnly (c) is correct
COnly (a) and (c) are correct
DOnly (b) and (c) are correct
Show answerHide answer
Correct answer: (D) Only (b) and (c) are correct
Explanation
Corrected: the book's key says (c). A cycle in a resource-allocation graph does not always mean deadlock (with multiple instances), so A is false; B and C are correct.
This question is based on the following SQL Table.
Mr. Aman, a Computer Science Teacher maintains the details of his class 12 Students is a SQL table as follow :
Table Name : MYSTUDENT
ROLLNO | NAME | SEC | MARKS
80105 | MARIA | A | 83.0
80108 | AMAR | B | 44.0
80109 | MANPREET | A | 92.0
80112 | SAMEER | A | 81.0
80115 | AKBAR | B | NULL
Identify the most Suitable Command to display the merit List of his students where the details will be displayed in descending order of their marks. If some students have same MARKs, their detail will be displayed in ascending order of their ROLLNO.
ASELECT * FROM MYSTUDENT ORDER BY DESC MARKS, ASC ROLLNO;
BSELECT * FROM MYSTUDENT ORDER BY MARKS DESC, ROLLNO ASC;
CSELECT * FROM MYSTUDENT ORDER BY MARKS; ROLLNO DESC, ASC;
DSELECT * FROM MYSTUDENT ORDER BY MARKS DESC; ROLLNO ASC;
Show answerHide answer
Correct answer: (B) SELECT * FROM MYSTUDENT ORDER BY MARKS DESC, ROLLNO ASC;
Explanation
ORDER BY takes the column first and the direction after it, separated by commas: ORDER BY MARKS DESC, ROLLNO ASC sorts by marks high to low and breaks ties by roll number ascending. The other options have wrong syntax.
This question is based on the following SQL Table.
Mr. Aman, a Computer Science Teacher maintains the details of his class 12 Students is a SQL table as follow :
Table Name : MYSTUDENT
ROLLNO | NAME | SEC | MARKS
80105 | MARIA | A | 83.0
80108 | AMAR | B | 44.0
80109 | MANPREET | A | 92.0
80112 | SAMEER | A | 81.0
80115 | AKBAR | B | NULL
Which of the following command can display the SEC wise Average of the student ?
ASELECT SEC, AVG (MARKS) FROM MYSTUDENT ORDER BY SEC;
BSELECT SEC, AVG (MARKS) FROM MYSTUDENT GROUP BY MARKS;
CSELECT *SEC, AVG (MARKS) FROM MYSTUDENT GROUP BY SEC;
DSELECT AVG (MARKS) FROM MYSTUDENT ORDER BY SEC;
Show answerHide answer
Correct answer: (C) SELECT *SEC, AVG (MARKS) FROM MYSTUDENT GROUP BY SEC;
Explanation
Section-wise averages need GROUP BY SEC with SELECT SEC, AVG(MARKS); ORDER BY only sorts and does not form groups, and GROUP BY MARKS groups the wrong column. Option C is the intended query (the "*" is a printing slip).
Consider the following expression tree.
Tree: root is '+'; its left child is 'a' and its right child is '*'; the '*' node has left child 'b' and right child 'c'.
In-order, pre-order and post-order traversal of this tree will result into which of the following expressions, respectively.
Running time of a 'for' loop is ______ the running time of the statements inside the for loop times the number of iterations.
AAtleast
BAtmost
CEqual to
DIndependent of
Show answerHide answer
Correct answer: (B) Atmost
Explanation
The loop body runs once per iteration, so the loop's running time is at most the time of the statements inside it (including the test) multiplied by the number of iterations.
The diagram below depicts :
Figure: a repeating sine-like wave plotted against time (in seconds) on the horizontal axis; the vertical extent is marked 'amplitude', the distance between two successive peaks is marked 'period', the top of a wave is labelled 'crest' and the bottom is labelled 'trough'.
ASound in wave form.
BWind frequency.
CLine of sight.
DCompressions on a map.
Show answerHide answer
Correct answer: (A) Sound in wave form.
Explanation
The figure shows a wave with amplitude, period, crest and trough plotted against time, which is how a sound wave is represented.
A transient of 100 ms is to be captured on a digital storage oscilloscope on full screen in the horizontal direction. If the transient is to be recorded at a sampling rate of 100 KS/s, what should the minimum size of the acqisition memory be ?
A5K
B10K
C15K
D20K
Show answerHide answer
Correct answer: (B) 10K
Explanation
Samples needed = sampling rate × time = 100,000 per second × 0.1 s = 10,000 samples, so the acquisition memory must hold at least 10K.
The XML declaration in the prolog starts with <?xml, as in <?xml version="1.0"?>. Option A is the only one that uses the <? processing-instruction form.
The diagram below represents
Figure: a log-scale graph of 'Transistors per chip' (10³ to 10⁹) on the vertical axis against years 1970 to 2010 on the horizontal axis; the plotted points rise along a straight line on the log scale (doubling at regular intervals), ending at a '1 billion transistor CPU' near 2010.
AMoore' law.
BNewton Raphson method.
CBoyle's law.
DGregor law.
Show answerHide answer
Correct answer: (A) Moore' law.
Explanation
The log-scale graph shows transistors per chip doubling at regular intervals, which is Moore's law.
______ is the first Intel x86 microprocessor with a dual core, referring to the implementation of two processors on a single chip.
ACore
BCore 2 duo
CDual core
DCentrino
Show answerHide answer
Correct answer: (A) Core
Explanation
Following Stallings' list of Intel processors, the Intel Core was the first x86 microprocessor with a dual core, meaning two processors on a single chip. Core 2 Duo came later.
Semaphores are used to solve the problem of ______.
AMutual exclusion
BRace condition
CProcess synchronization
DThe belady problem
Show answerHide answer
Correct answer: (C) Process synchronization
Explanation
Semaphores are a synchronization tool. They control how concurrent processes access shared resources, which solves process synchronization problems, including mutual exclusion.
In the context of Visual Basic, multiple controls of the same type can be grouped into an array, in the same manner as a collection of data items. Such a grouping is known as :
AControl array
BPrimary array
CSecondary array
DAn integer array
Show answerHide answer
Correct answer: (A) Control array
Explanation
A control array is a group of controls of the same type that share one name and are told apart by an Index property.
Consider two database relations R and S having 3 tuples in R and 2 tuples in S. What is the maximum number of tuples that could appear in the natural join of R and S?
A6
B2
C3
D5
Show answerHide answer
Correct answer: (A) 6
Explanation
At most, the natural join can produce every combination, as when there are no common attributes or every row shares the same common value. That is 3 × 2 = 6 tuples.
File operations that manipulate the 'open-count' maintained for each entry in open-file table include:
AOpen, write
BRead, write
CWrite, close
DOpen, close
Show answerHide answer
Correct answer: (D) Open, close
Explanation
The open-count records how many processes have the file open. open() increments it and close() decrements it, and the entry is removed when it reaches zero.
Given the list of tasks in Col-A and list of data structure in Col-B. Identify the best match.
Col-A | Col-B
A. Recursion | (i) Binary tree
B. Scheduling | (ii) Stack
C. Sorting | (iii) Queue
AA-(i), B-(iii), C-(ii)
BA-(ii), B-(i), C-(iii)
CA-(iii), B-(ii), C-(i)
DA-(ii), B-(iii), C-(i)
Show answerHide answer
Correct answer: (D) A-(ii), B-(iii), C-(i)
Explanation
Recursion uses a stack of activation records, scheduling uses a queue (first come, first served), and sorting can use a binary tree (as in a BST or heap).
Which of the following applications may use a stack?
(A) Parenthesis balancing program
(B) Process scheduling in operating system
(C) Conversion of infix arithmetic expression to postfix form
A(A) and (B)
B(B) and (C)
C(A) and (C)
D(A), (B) and (C)
Show answerHide answer
Correct answer: (C) (A) and (C)
Explanation
Stacks are used for parenthesis balancing and infix-to-postfix conversion, so (A) and (C) are correct. Process scheduling uses queues, not stacks.
In which of the following, the density of the core remains constant from the center to the edges?
ASingle mode fiber
BMultimode step-index fiber
CMultimode graded-index fiber
DSingle mode step-index fiber
Show answerHide answer
Correct answer: (B) Multimode step-index fiber
Explanation
In a multimode step-index fiber, the core has the same density (refractive index) everywhere, with a sudden step at the cladding. In graded-index fiber the density changes gradually.
MPEG involves both spatial compression and temporal compression. The spatial compression is similar to JPEG and temporal compression removes ______ frames.
AVoice
BSpatial
CTemporal
DRedundant
Show answerHide answer
Correct answer: (D) Redundant
Explanation
MPEG temporal compression removes redundant frames. Consecutive frames are largely the same, so only the differences from reference frames are stored.
A hash table of length 10 uses open addressing with hash function h(k) = kmod 10 and linear probing. After inserting 6 values into an empty hash table, the table is shown below:
Slot | Key
0 |
1 |
2 | 42
3 | 23
4 | 34
5 | 52
6 | 46
7 | 33
8 |
9 |
Which of the following choices gives a possible order in which the key values could have been inserted in the table?
A46, 42, 34, 52, 23, 33
B34, 42, 23, 52, 33, 46
C46, 34, 42, 23, 52, 33
D42, 46, 33, 23, 34, 52
Show answerHide answer
Correct answer: (C) 46, 34, 42, 23, 52, 33
Explanation
Order C reproduces the table: 46→6, 34→4, 42→2, 23→3, 52→2 (taken) then 3, 4 (taken) so 5, and 33→3 then 4, 5, 6 (taken) so 7.
Consider the following statements respect to JavaScript :
(I) A variable is created using the keyword.
(II) JavaScript is untyped language.
Which of the above are true ?
ANeither (I) not (II)
B(I) only
C(II) only
DBoth (I) and (II)
Show answerHide answer
Correct answer: (D) Both (I) and (II)
Explanation
Both statements are true as intended: in JavaScript a variable is created with the var keyword (the word is missing from the question), and JavaScript is loosely (dynamically) typed, so variables have no fixed type.
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.