DSSSB TGT / PGT · Topic-wise previous year questions
Computer Science Previous Year Questions (page 38)
2444 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.
What will be the output of the following C code?
#include <stdio.h>
int main() {
int i;
for (i = 1; i <= 10; i++)
{
if (++i % 2 == 0)
printf("%d ", i);
}
return 0;
}
A1 2 3 4 5 6 7 8 9 10
B2 4 6 8 10
C1 3 5 7 9
D2 4 6 8
Show answerHide answer
Correct answer: (B) 2 4 6 8 10
Explanation
++i inside the if makes i even each time it is tested: i goes 1 to 2 (printed), then the loop's i++ makes 3, ++i makes 4 (printed), and so on up to 10. Then i becomes 11 and the loop stops, so 2 4 6 8 10 is printed.
Which sorting algorithm performs the worst when the input array is nearly sorted?
ABubble Sort
BInsertion Sort
CHybrid Sort
DMax Sort
Show answerHide answer
Correct answer: (B) Insertion Sort
Explanation
Note: the answer key gives (B), but insertion sort is actually the best choice for a nearly sorted array: each element moves only a few places, so it runs in close to O(n) time. The question seems to have intended "best" rather than "worst".
What is the output of the given C programming code?
#include <stdio.h>
void modify(int arr[], int n)
{
for(int i = 0; i < n; i++)
arr[i] = arr[i] * 2;
}
int main()
{
int data[] = {1, 2, 3, 4};
modify(data, 4);
printf("%d", data[2]);
return 0;
}
A8
B4
C6
D2
Show answerHide answer
Correct answer: (C) 6
Explanation
Arrays are passed as a pointer to their first element, so modify() doubles the original elements: data becomes {2, 4, 6, 8}, and data[2] = 6.
R2 - 2R1 gives [0, -2, 2, 6] and R3 - 4R1 gives [0, -3, 3, 9], which is 1.5 times the new R2, so one row becomes zero. The rank is 2, so the normal form is [I2 0; 0 0].
Which of the following statements is correct about function prototypes in C?
AFunction prototype provides the code of the function, which will be executed when
called.
BFunction prototype provides the complete implementation of a function, including the
return type, name, parameters, and statements that make up the function’s body.
CFunction prototypes tell the compiler the number and type of arguments that are to be
passed to the function and the type of value that is to be returned by the function.
DFunction prototypes are typically placed at the end of the code after the main function.
Show answerHide answer
Correct answer: (C) Function prototypes tell the compiler the number and type of arguments that are to be
passed to the function and the type of value that is to be returned by the function.
Explanation
A prototype declares the function's return type, name and the number and types of its parameters (ending with a semicolon), so the compiler can check calls. It has no body and is usually placed before main.
In C programming, which of the following is correct about why all pointers should be
set to NULL if they are not pointing to anything?
AWhen a pointer is initialized to NULL, it does not help in avoiding dangling pointers
(pointers that reference invalid or deallocated memory).
BSetting pointers to NULL is merely a norm and has no effect on program execution.
CIf a pointer is not pointing to anything, the program won’t execute at all, giving a syntax
error message.
DWhen a pointer is initialized to NULL, it signifies that the pointer does not currently
reference any valid memory location.
Show answerHide answer
Correct answer: (D) When a pointer is initialized to NULL, it signifies that the pointer does not currently
reference any valid memory location.
Explanation
A NULL pointer explicitly marks that the pointer refers to no valid memory, so the code can test if (p == NULL) before use, avoiding accidental use of garbage or dangling addresses.
The conjugate replaces every i by -i in each element: i becomes -i, 1+i becomes 1-i, 3-2i becomes 3+2i, 2-i becomes 2+i, -3i becomes 3i, 1-i becomes 1+i and 2i becomes -2i. Real entries 4 and 5 stay the same.
In case of a Real Account, the general rule of accounting is:
ADebit what comes in and credit what goes out
BDebit the giver and credit the receiver
CDebit the receiver and credit the giver
DDebit expenses or losses, credit incomes or gains
Show answerHide answer
Correct answer: (A) Debit what comes in and credit what goes out
Explanation
Real accounts (assets) follow the rule: debit what comes in and credit what goes out. "Debit the receiver, credit the giver" is for personal accounts, and expenses/incomes is the rule for nominal accounts.
Which of the following options is a Hermitian matrix?
AA =
[ 1 2+3i ]
[ 2−3i 5 ]
BA =
[ 1 2+3i ]
[ −2+3i −1 ]
CA =
[ 1 2+3i ]
[ −2−3i 5 ]
DA =
[ 1 2+3i ]
[ 2+3i 1 ]
Show answerHide answer
Correct answer: (A) A =
[ 1 2+3i ]
[ 2−3i 5 ]
Explanation
A Hermitian matrix equals its conjugate transpose: diagonal entries are real and a_ji is the conjugate of a_ij. In A the diagonal is 1 and 5 and the off-diagonal entries 2+3i and 2-3i are conjugates.
A trader purchased goods worth ₹2,50,000 and paid ₹15,000 as carriage on those
goods. He sold the goods for ₹3,75,000 and paid ₹10,000 towards carriage on them. He
also incurred ₹10,000 towards other general expenditure. What shall be the gross profit
of the trader?
A₹1,10,000
B₹1,00,000
C₹1,25,000
D₹90,000
Show answerHide answer
Correct answer: (A) ₹1,10,000
Explanation
Gross profit = sales - (purchases + direct expenses) = 3,75,000 - (2,50,000 + 15,000) = 1,10,000. Carriage on sales and general expenses are indirect expenses charged to the P&L account, not the trading account.
In designing a microprogrammed control unit, what is stored in the control memory?
AAddressing modes for memory access
BMicroinstructions that define control signals
CMachine-level instructions
DData values used by the CPU
Show answerHide answer
Correct answer: (B) Microinstructions that define control signals
Explanation
In a microprogrammed control unit, the control memory (usually ROM) holds the microprograms, i.e. sequences of microinstructions whose bits generate the control signals.
Which addressing mode uses the actual address of the data in the instruction?
AIndirect addressing
BImmediate addressing
CDirect addressing
DRegister addressing
Show answerHide answer
Correct answer: (C) Direct addressing
Explanation
In direct (absolute) addressing, the instruction's address field holds the actual memory address of the operand. Immediate addressing holds the data itself and indirect holds the address of the address.
Which of the following statements is/are true?
P: The size of a linked list can grow and shrink dynamically during runtime based on
the operations performed.
Q: Unlike arrays, linked lists allow for constant-time access to elements by index.
R: The dynamic nature of linked lists means that memory for nodes is allocated only
when necessary, leading to better space utilisation.
AP, Q, R
BOnly P and Q
COnly P and R
DOnly P
Show answerHide answer
Correct answer: (C) Only P and R
Explanation
P is true (lists grow and shrink at run time) and R is true (nodes are allocated only when needed). Q is false: linked lists need O(n) traversal to reach an index; arrays give constant-time indexed access.
When exposed to a magnetic field, paramagnetic materials are __________.
Astrongly repelled
Bunaffected
Cweakly attracted
Dstrongly attracted
Show answerHide answer
Correct answer: (C) weakly attracted
Explanation
Paramagnetic materials (aluminium, platinum) have a small positive susceptibility, so they are weakly attracted towards a magnetic field. Diamagnetic ones are weakly repelled and ferromagnetic ones strongly attracted.
_________ materials are strongly attracted to regions of high magnetic field intensity
due to _________.
AFerromagnetic ; domains formed by an applied field
BParamagnetic ; domains where dipoles align spontaneously
CParamagnetic ; domains formed by an applied field
DFerromagnetic ; domains where dipoles align spontaneously
Show answerHide answer
Correct answer: (D) Ferromagnetic ; domains where dipoles align spontaneously
Explanation
In ferromagnetic materials (iron, cobalt, nickel) atomic dipoles align spontaneously in small regions called domains. An external field grows and aligns these domains, so the material is strongly attracted.
Which of the following operations is NOT performed by the ALU?
ABitwise operations
BMemory addressing
CArithmetic operations
DLogical comparisons
Show answerHide answer
Correct answer: (B) Memory addressing
Explanation
The ALU performs arithmetic, logical, bitwise and comparison operations. Memory addressing is handled by the control unit and address registers/MMU, not the ALU.
In assembly, how is a macro invoked after its definition?
ABy using the JMP instruction
BBy using the CALL instruction
CBy writing its name followed by MACRO
DBy simply writing its name with any required parameters
Show answerHide answer
Correct answer: (D) By simply writing its name with any required parameters
Explanation
After defining a macro, you invoke it by writing its name (with any arguments) as if it were an instruction; the assembler then expands the macro body in place. CALL is for procedures, not macros.
Which of the following is NOT a component of commerce?
AMining
BInsurance
CTransportation
DWarehousing
Show answerHide answer
Correct answer: (A) Mining
Explanation
Commerce covers trade and the aids to trade such as transport, warehousing, insurance, banking and advertising. Mining is an extractive industry, part of industry rather than commerce.
Which of the following is an example of System Software?
ADatabase Management System (DBMS)
BCompiler
CWeb Browser
DWord Processor
Show answerHide answer
Correct answer: (B) Compiler
Explanation
A compiler is system software (a language translator) that supports program development. DBMS, web browsers and word processors are application software.
Which document is mandatory for incorporation of a One Person Company (OPC)?
ATrust Deed
BArticle of Association
CCertificate of Commencement
DPartnership Deed
Show answerHide answer
Correct answer: (B) Article of Association
Explanation
An OPC is a company, so it is incorporated by filing a Memorandum and Articles of Association. Trust and partnership deeds are for other forms of organisation, and certificate of commencement is not needed for an OPC.
Which document defines the scope and objectives of a company and serves as its
constitution?
AArticles of Association
BCertificate of Incorporation
CProspectus
DMemorandum of Association
Show answerHide answer
Correct answer: (D) Memorandum of Association
Explanation
The Memorandum of Association is the company's charter (constitution): it defines its name, registered office, objects, liability and capital, i.e. the scope of its activities. The Articles deal with internal rules.
Suppose that a biased coin is tossed such that P(H) = 2/3 and P(T) = 1/3.
If head (H) appears, a number between is selected between 1 through 9. If tail (T)
appears, then a number is selected between 1 through 5. The probability that an even
number is selected is approximately equal to:
Which component is considered the 'brain' of the computer?
AHDD
BRAM
CROM
DCPU
Show answerHide answer
Correct answer: (D) CPU
Explanation
The CPU processes all instructions and controls the other components, so it is called the brain of the computer. RAM, ROM and HDD are memory and storage.
AIt is an input device used for scanning documents.
BIt is used to input audio data.
CIt is used to print high-quality graphics and designs.
DIt is faster than a laser printer plotter.
Show answerHide answer
Correct answer: (C) It is used to print high-quality graphics and designs.
Explanation
A plotter is an output device that draws large, precise graphics such as engineering drawings, maps and designs with pens or inkjet. It is slower than a laser printer.
Which of the following actions demonstrates good netiquette in an online forum?
ASharing personal information without permission
BUsing proper grammar and punctuation
CPosting irrelevant content repeatedly
DResponding to others' posts with insults
Show answerHide answer
Correct answer: (B) Using proper grammar and punctuation
Explanation
Netiquette means polite online behaviour: proper grammar and punctuation, respectful replies, relevant posts and privacy for others. Insults, spam and sharing others' personal data violate it.
Which of the following best describes an open-ended question in a questionnaire?
A“Do you think pollution affects health?” (Yes/No)
B“Circle the correct year of independence: a) 1945 b) 1946 c) 1947 d) 1948”
C“List any three reasons why students drop out of school.”
D“Is your school equipped with smart classrooms? Yes/No”
Show answerHide answer
Correct answer: (C) “List any three reasons why students drop out of school.”
Explanation
An open-ended question lets respondents answer freely in their own words, such as listing reasons. Yes/No and multiple-choice items are closed-ended questions.
How can curriculum content be gender-equitable for girls who are marginalised?
ABy only using native tongues when instructing
BBy only imparting advanced scientific knowledge
CBy pressuring girls to conform to gender norms
DBy providing literacy instruction that boosts self-esteem and changes people's lives
Show answerHide answer
Correct answer: (D) By providing literacy instruction that boosts self-esteem and changes people's lives
Explanation
A gender-equitable curriculum for marginalised girls gives literacy and life-skill education that builds self-esteem and empowers them to change their lives, rather than reinforcing gender norms.
The step ‘Generalization’ in the Herbartian model aims at which of the following?
ARepeating the entire lesson
BFormulating universal rules
CProviding entertainment to learners
DAssigning homework
Show answerHide answer
Correct answer: (B) Formulating universal rules
Explanation
In Herbart's generalisation step, learners draw general principles, rules or definitions from the examples studied earlier. Application then uses these rules in new situations.
According to Howard Gardner’s theory, which of the following intelligences is NOT a
component of multiple intelligences?
ABodily-kinesthetic
BLogical-mathematical
CMusical
DEmotional
Show answerHide answer
Correct answer: (D) Emotional
Explanation
Gardner's multiple intelligences include linguistic, logical-mathematical, spatial, musical, bodily-kinesthetic, interpersonal, intrapersonal and naturalist. Emotional intelligence was popularised by Goleman, not part of Gardner's list.
Which scheme was specifically revised in 1992 to promote education of children with
disabilities in mainstream schools?
ASarva Shiksha Abhiyan
BSamagra Shiksha Abhiyan
CNational Inclusive Education Scheme
DIntegrated Education for Disabled Children (IEDC)
Show answerHide answer
Correct answer: (D) Integrated Education for Disabled Children (IEDC)
Explanation
The Integrated Education for Disabled Children (IEDC) scheme, launched in 1974, was revised in 1992 to place children with disabilities in regular schools. SSA came in 2001 and Samagra Shiksha in 2018.
The process of acquiring knowledge through observation and experiences is called
_________.
Aempiricism
Btenacity
Cauthority
Drevelation
Show answerHide answer
Correct answer: (A) empiricism
Explanation
Empiricism holds that knowledge comes from sensory experience and observation (Locke, Hume). Tenacity, authority and revelation rely on habit, experts or divine sources.
Which of the following curriculum approaches focuses on real-life problem-solving and
interdisciplinary learning?
AActivity-based
BSubject-centered
CProblem-centered
DLearner-centered
Show answerHide answer
Correct answer: (C) Problem-centered
Explanation
The problem-centred curriculum is organised around real-life problems that learners solve by drawing on several subjects, so it is interdisciplinary. The subject-centred approach keeps subjects separate.
Listening is a receptive skill: it focuses on comprehending spoken (oral) input. Producing writing and constructing utterances are productive skills (writing and speaking).
What is the key method of learning in the behavioristic approach?
AObservation
BDiscussion
CReflection
DConditioning
Show answerHide answer
Correct answer: (D) Conditioning
Explanation
Behaviourists (Pavlov, Watson, Skinner) explain learning as conditioning, forming stimulus-response links through classical or operant conditioning with reinforcement. Observation is the basis of social learning theory.
How does the Best Fit algorithm impact system performance?
AIt improves system performance by reducing memory wastage.
BIt may reduce system performance due to increased search time for free blocks.
CIt always improves system performance.
DIt improves system performance by reducing external fragmentation.
Show answerHide answer
Correct answer: (B) It may reduce system performance due to increased search time for free blocks.
Explanation
Best Fit must search the whole free list (or keep it sorted) to find the smallest hole that fits, so allocation takes longer. It also leaves many tiny unusable holes, so it does not guarantee less wastage or better performance.
Which of the following SQL expressions evaluates to TRUE, according to SQL-99?
ANULL <= NULL returns UNKNOWN
BNULL >= NULL returns UNKNOWN
CNULL IS NULL returns FALSE
DNULL IS NULL returns TRUE
Show answerHide answer
Correct answer: (D) NULL IS NULL returns TRUE
Explanation
Any ordinary comparison involving NULL (=, <=, >= etc.) gives UNKNOWN, not TRUE. The IS NULL predicate is the special test for nulls, so NULL IS NULL is TRUE.
Which of the following statements is false about universal logic gates?
AAll basic logic gates can be implemented through universal logic gates.
BNOR gate is known as universal logic gate.
CNAND gate is known as universal logic gate.
DAll basic logic gates cannot be implemented using universal logic gates.
Show answerHide answer
Correct answer: (D) All basic logic gates cannot be implemented using universal logic gates.
Explanation
NAND and NOR are universal gates precisely because AND, OR and NOT (and hence every other gate) can be built from them alone, so the statement that basic gates cannot be built from them is false.
If a process arrives at time 5, what is the latest possible time for it to start execution if there
are no other processes in the system?
ATime 6
BTime 0
CTime 5
DTime 4
Show answerHide answer
Correct answer: (C) Time 5
Explanation
With no other process competing, the CPU is idle and the process is dispatched as soon as it arrives, at time 5. It cannot start before it arrives (time 0 or 4).
Which of the following describes the use of digital certificates in authentication?
AThey store the user's passwords.
BThey compress large files for secure transfer.
CThey verify the identity of entities using Public Key Infrastructure (PKI).
DThey encrypt data transmission.
Show answerHide answer
Correct answer: (C) They verify the identity of entities using Public Key Infrastructure (PKI).
Explanation
Note: the official answer key marks option 2. Conceptually, digital certificates verify the identity of an entity using PKI (option 3). The key has been kept as published.
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.