DSSSB TGT / PGT · Topic-wise previous year questions

Computer Science Previous Year Questions (page 37)

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.

  • 2444 questions
  • 20 topics
  • Official answer key
  • Free

Practise by topic

Q1801DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following statements regarding the Best Fit memory allocation strategy is true?
  1. ABest Fit may cause excessive fragmentation by creating many small unusable holes.
  2. BBest Fit always allocates memory faster since it searches the larger free partition.
  3. CBest Fit prefers allocating memory at the start of the memory block list.
  4. DBest Fit merges adjacent free partitions soon after allocation.
Show answerHide answer

Correct answer: (A) Best Fit may cause excessive fragmentation by creating many small unusable holes.

Explanation

Best Fit chooses the smallest hole that fits, so the leftover pieces are tiny and often too small to use, causing external fragmentation. It also searches the entire list, so it is not faster.

Q1802DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is INCORRECT, as per a 2-input OR gate truth table?
  1. AIf input A=1, B=0, then output Y=1.
  2. BIf input A=0, B=0, then output Y=1.
  3. CIf input A=1, B=1, then output Y=1.
  4. DIf input A=0 , B=1, then output Y=1.
Show answerHide answer

Correct answer: (B) If input A=0, B=0, then output Y=1.

Explanation

An OR gate gives 0 only when all inputs are 0. So A = 0, B = 0 gives Y = 0, and the statement Y = 1 is incorrect.

Q1803DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following statements about WITH CHECK OPTION in SQL views is true?
  1. AIt ensures that inserted/updated rows satisfy the view’s WHERE clause.
  2. BIt prevents any alter through the view.
  3. CIt allows only ALTER operations on the view.
  4. DIt makes the view read-only.
Show answerHide answer

Correct answer: (A) It ensures that inserted/updated rows satisfy the view’s WHERE clause.

Explanation

WITH CHECK OPTION rejects any INSERT or UPDATE through the view that would produce a row not satisfying the view's WHERE condition (a row that would vanish from the view).

Q1804DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What type of argument does the CloseHandle system call require?
  1. APointer to the memory buffer
  2. BFile name
  3. CHandle to the file or resource
  4. DFile path
Show answerHide answer

Correct answer: (C) Handle to the file or resource

Explanation

CloseHandle takes one argument, the HANDLE of the open object (file, process, thread etc.) returned earlier by functions such as CreateFile.

Q1805DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is true about FCFS disk scheduling?
  1. AIt provides the best throughput compared to other algorithms.
  2. BIt ensures the shortest seek time first.
  3. CIt causes minimal delay for all processes.
  4. DIt serves requests in the order they are received.
Show answerHide answer

Correct answer: (D) It serves requests in the order they are received.

Explanation

FCFS (first come, first served) serves disk requests strictly in arrival order. It is fair and simple, but it does not minimise seek time or give the best throughput.

Q1806DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What is a transport layer address typically called?
  1. ASubnet Mask
  2. BPort Numbe
  3. CMAC Address
  4. DIP Address
Show answerHide answer

Correct answer: (B) Port Numbe

Explanation

The transport layer identifies a process on a host by a port number (16 bits in TCP/UDP). MAC addresses belong to the data link layer and IP addresses to the network layer.

Q1807DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is NOT a phase of TCP congestion control?
  1. ASlow start
  2. BData fragmentation
  3. CFast retransmit
  4. DCongestion avoidance
Show answerHide answer

Correct answer: (B) Data fragmentation

Explanation

TCP congestion control uses slow start, congestion avoidance, fast retransmit and fast recovery. Fragmentation of data is done at the IP (network) layer, not a congestion control phase.

Q1808DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following best describes the function of a NOT gate?
  1. AIt performs logical multiplication.
  2. BIt passes the input as output without change.
  3. CIt performs logical addition.
  4. DIt inverts the input signal.
Show answerHide answer

Correct answer: (D) It inverts the input signal.

Explanation

A NOT gate (inverter) has one input and outputs its complement: 0 becomes 1 and 1 becomes 0. AND is logical multiplication and OR is logical addition.

Q1809DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following correctly describes a TCP connection termination?
  1. AIt is immediate and requires no acknowledgment.
  2. BIt does not involve the FIN flag.
  3. CIt uses a two-way handshake.
  4. DIt ensures both the sender and receiver agree to close the connection.
Show answerHide answer

Correct answer: (D) It ensures both the sender and receiver agree to close the connection.

Explanation

TCP connection termination is graceful: each side sends a FIN and the other acknowledges it (a four-way exchange), so both ends agree to close. It is not immediate and does use the FIN flag.

Q1810DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
In TCP, which flag is used to initiate connection termination?
  1. AACK
  2. BRST
  3. CFIN
  4. DSYN
Show answerHide answer

Correct answer: (C) FIN

Explanation

A host sends a segment with the FIN flag set to start closing the connection. SYN opens a connection and RST aborts it abruptly.

Q1811DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
SELECT MAX(result) FROM student WHERE result < (SELECT MAX(result) FROM student);
  1. ASELECT result FROM student WHERE ROWNUM = 2 ORDER BY result DESC;
  2. BSELECT TOP 2 result FROM student ORDER BY result DESC;
  3. CSELECT result FROM student ORDER BY result DESC LIMIT 1 OFFSET 1;
  4. DSELECT MAX(result) FROM student WHERE result < (SELECT MAX(result) FROM student);
Show answerHide answer

Correct answer: (D) SELECT MAX(result) FROM student WHERE result < (SELECT MAX(result) FROM student);

Explanation

Note: the question statement is missing in the source paper; only the SQL query shown above and the options were printed. The official answer key marks option 4 (the same query as the one shown).

Q1812DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What type of data does RTP (Real Time Protocol) primarily support?
  1. AText documents
  2. BFile transfers
  3. CEncrypted email attachments
  4. DReal-time multimedia (audio and video)
Show answerHide answer

Correct answer: (D) Real-time multimedia (audio and video)

Explanation

RTP carries real-time audio and video (VoIP, video conferencing, streaming), with timestamps and sequence numbers, usually over UDP.

Q1813DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
While creating a new table ProductOrder_2026, which SQL statement correctly inserts all the records from the ProductOrder_2026 table into ProductOrder?
  1. ACREATE TABLE ProductOrder_2026 AS CREATE * FROM ProductOrder;
  2. BCREATE TABLE ProductOrder_2026 AS SELECT * FROM ProductOrder;
  3. CCREATE TABLE ProductOrder_2026 AS UPDATE * FROM ProductOrder;
  4. DCREATE TABLE ProductOrder_2026 AS INSERT * FROM ProductOrder ;
Show answerHide answer

Correct answer: (B) CREATE TABLE ProductOrder_2026 AS SELECT * FROM ProductOrder;

Explanation

CREATE TABLE new_table AS SELECT * FROM old_table creates the new table and copies all rows of the old one into it. CREATE, UPDATE or INSERT cannot follow AS here.

Q1814DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following conditions must be satisfied to solve the critical section problem?
  1. ASemaphore, mutex, and locks
  2. BMutual exclusion, progress, and bounded waiting
  3. CPriority inversion, deadlock, and throughput
  4. DStarvation, fairness, and scheduling
Show answerHide answer

Correct answer: (B) Mutual exclusion, progress, and bounded waiting

Explanation

A correct solution to the critical-section problem must satisfy mutual exclusion, progress and bounded waiting. Semaphores, mutexes and locks are tools for achieving this, not the conditions.

Q1815DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What will be the output of the following code? #include <stdio.h> int main() { int x = 5; switch(x) { case 5: printf("Five"); default: printf("Default"); } return 0; }
  1. ADefault
  2. BCompilation error
  3. CFive
  4. DFiveDefault
Show answerHide answer

Correct answer: (D) FiveDefault

Explanation

case 5 matches and prints "Five". There is no break, so control falls through to default and also prints "Default", giving FiveDefault.

Q1816DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What happens if you try to use an uninitialised variable in C?
  1. AThe program will throw a runtime error.
  2. BThe variable contains garbage (indeterminate) value.
  3. CThe program will not compile.
  4. DThe variable is automatically initialised to 0.
Show answerHide answer

Correct answer: (B) The variable contains garbage (indeterminate) value.

Explanation

A local (automatic) variable that is not initialised holds an indeterminate (garbage) value. The program still compiles and runs, but results are unpredictable.

Q1817DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Consider the following Java code snippet: class Animal { String name; int age; Animal() { this.name = "Unknown"; this.age = 0; } Animal(String name, int age) { this.name = name; this.age = age; } void displayInfo() { System.out.println("Animal: " + name + ", Age: " + age); } } public class Main { public static void main(String[] args) { Animal a1 = new Animal(); Animal a2 = new Animal("Dog", 5); a1.displayInfo(); a2.displayInfo(); // Error-prone code: //1. Animal a3 = new Animal("Cat"); //2. a2.name = null; a2.displayInfo(); // 3. Animal a4 = null; a4.displayInfo(); } } Which of the following statements is/are true regarding the above code? 1. The Animal class supports both default and parameterized constructors. 2. If line 1 in the comment is uncommented, the code will compile and run successfully. 3. If line 2 is executed, a2.displayInfo() will print "Animal: null, Age: 5". 4. If line 3 is executed, the program will throw a NullPointerException at runtime.
  1. A1 and 4 only
  2. B2 only
  3. C1,2 and 4 only
  4. D1,3 and 4 only
Show answerHide answer

Correct answer: (D) 1,3 and 4 only

Explanation

1 is true (no-arg and two-arg constructors). 2 is false: there is no Animal(String) constructor, so it would not compile. 3 is true: concatenating null prints "null". 4 is true: calling a method on a null reference throws NullPointerException.

Q1818DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What is the output of the following code? #include <stdio.h> int main() { printf("%d", printf("C Programming")); return 0; }
  1. A13
  2. BC Programming
  3. CC Programming12
  4. DC Programming13
Show answerHide answer

Correct answer: (D) C Programming13

Explanation

The inner printf runs first, prints "C Programming" and returns the number of characters printed, 13. The outer printf then prints 13, giving "C Programming13".

Q1819DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
How many times will the following loop execute? for (int i = 0; i < 5; i++) { printf("%d ", i); }
  1. AInfinite
  2. B4
  3. C5
  4. D6
Show answerHide answer

Correct answer: (C) 5

Explanation

i takes values 0, 1, 2, 3, 4; when i becomes 5 the condition i < 5 fails, so the loop executes 5 times.

Q1820DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Convert the decimal number 325 to its octal equivalent.
  1. A514
  2. B485
  3. C541
  4. D505
Show answerHide answer

Correct answer: (D) 505

Explanation

325 / 8 = 40 remainder 5, 40 / 8 = 5 remainder 0, 5 / 8 = 0 remainder 5. Reading remainders bottom up gives 505 in octal (5 x 64 + 0 + 5 = 325).

Q1821DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following demonstrates the implementation of inheritance in Java?
  1. Aclass B inherits A {}
  2. Bclass A contains B {}
  3. Cclass A implements B {}
  4. Dclass A extends B {}
Show answerHide answer

Correct answer: (D) class A extends B {}

Explanation

Java uses the keyword extends for class inheritance, e.g. class A extends B. implements is used when a class implements an interface; inherits and contains are not Java keywords.

Q1822DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Consider the following code snippet. What will it print? #include <stdio.h> int main() { char str[][10] = {"one", "two", "three"}; printf("%c\n", str[2][4]); return 0; }
  1. Ar
  2. Be
  3. Cthree
  4. Dh
Show answerHide answer

Correct answer: (B) e

Explanation

str[2] is "three" and indexing from 0 gives t(0), h(1), r(2), e(3), e(4), so str[2][4] is 'e'.

Q1823DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Convert the binary number (11011) 2 to its decimal equivalent.
  1. A29
  2. B27
  3. C31
  4. D25
Show answerHide answer

Correct answer: (B) 27

Explanation

11011 = 16 + 8 + 0 + 2 + 1 = 27.

Q1824DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is an invalid variable name in C?
  1. AfirstName
  2. Bvoid
  3. Ctotal_sum
  4. Dnum123
Show answerHide answer

Correct answer: (B) void

Explanation

void is a reserved keyword in C and cannot be used as an identifier. The other names use only letters, digits and underscores and start with a letter.

Q1825DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Given the following code, what will be the result? public class Test { public static void main(String[] args) { Object obj = new String("Hello"); String str = (String) obj; System.out.println(str); } }
  1. AThrows ClassCastException.
  2. BRuntime error.
  3. CHello will be printed.
  4. DCompilation error.
Show answerHide answer

Correct answer: (C) Hello will be printed.

Explanation

obj actually refers to a String object, so the downcast (String) obj succeeds at run time and "Hello" is printed. ClassCastException occurs only when the object is not of the target type.

Q1826DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What will be the output of the following code? #include <stdio.h> int main() { int arr[5] = {10, 20, 30, 40, 50}; int (*p)[5] = &arr; printf("%d\n", *(*p + 3)); return 0; }
  1. A40
  2. B30
  3. C20
  4. DCompilation Error
Show answerHide answer

Correct answer: (A) 40

Explanation

p points to the whole array, so *p is arr (the address of its first element). *p + 3 points to arr[3], and dereferencing gives 40.

Q1827DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What will be printed by the following code? #include<stdio.h> int main() { int marks = 75; char grade = (marks >= 90) ? 'A' : (marks >= 70) ? 'B' : 'C'; printf("%c", grade); return 0; }
  1. AB
  2. BCompile time error
  3. CA
  4. DC
Show answerHide answer

Correct answer: (A) B

Explanation

75 >= 90 is false, so the second condition is checked: 75 >= 70 is true, so grade is 'B'.

Q1828DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which among the following is an example of compile-time polymorphism in Java?
  1. AMethod overriding
  2. BInterfaces
  3. CAbstract classes
  4. DMethod overloading
Show answerHide answer

Correct answer: (D) Method overloading

Explanation

Method overloading (same name, different parameter lists) is resolved by the compiler, so it is compile-time (static) polymorphism. Method overriding is resolved at run time.

Q1829DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What is the output of the following code snippet? int x = 6; System.out.println(x++ + ++x);
  1. A12
  2. B14
  3. C11
  4. D13
Show answerHide answer

Correct answer: (B) 14

Explanation

x++ gives 6 and makes x 7; ++x then makes x 8 and gives 8. So 6 + 8 = 14.

Q1830DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What will be the output of the following code (assume size of int as 4 bytes in the system)? #include<stdio.h> int main() { int arr[5] = {1, 2, 3, 4, 5}; printf("%lu", sizeof(arr)); return 0; }
  1. A20
  2. B5
  3. Ccompile time error
  4. D4
Show answerHide answer

Correct answer: (A) 20

Explanation

sizeof on an array gives its total size in bytes: 5 elements x 4 bytes = 20.

Q1831DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
In the context of array types, what is the key difference between int *arr[5] and int (*arr) [5]?
  1. ABoth are syntactically incorrect
  2. BFirst is a pointer to an array, second is an array of pointers
  3. CThey are identical in their functionality
  4. DFirst is an array of pointers to integers, second is a pointer to an array of integers
Show answerHide answer

Correct answer: (D) First is an array of pointers to integers, second is a pointer to an array of integers

Explanation

[] binds tighter than *, so int *arr[5] is an array of 5 pointers to int. The parentheses in int (*arr)[5] make arr a single pointer to an array of 5 ints.

Q1832DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What will be the output of the following code? #include <stdio.h> int main() { int a = 2, b = 3; switch (a) { case 1: printf("Case 1"); break; case 2: switch (b) { case 3: printf("Case 3"); break; default: printf("Inner Default"); } default: printf("Outer Default"); } return 0; }
  1. ACase 3Inner Default
  2. BCase 3
  3. CInner DefaultOuter Default
  4. DCase 3Outer Default
Show answerHide answer

Correct answer: (D) Case 3Outer Default

Explanation

a = 2 selects case 2; the inner switch matches case 3, prints "Case 3", and its break exits only the inner switch. With no break after it, control falls into the outer default and prints "Outer Default".

Q1833DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which type of applications are commonly developed using Object-Oriented Programming?
  1. AOperating system kernals
  2. BMachine-level programs
  3. CMobile applications
  4. DAssembly-level programs
Show answerHide answer

Correct answer: (C) Mobile applications

Explanation

Mobile apps (Android in Java/Kotlin, iOS in Swift) and other large application software are commonly built with OOP. OS kernels and machine- or assembly-level programs are usually written in procedural C or assembly.

Q1834DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What is the primary restriction on nested functions in C?
  1. ANested functions are not allowed in standard C but are supported as extensions in some compilers.
  2. BNested functions must be declared as inline.
  3. CNested functions must be defined before their enclosing function.
  4. DNested functions are fully supported in standard C.
Show answerHide answer

Correct answer: (A) Nested functions are not allowed in standard C but are supported as extensions in some compilers.

Explanation

Standard C does not allow a function to be defined inside another function. GCC supports nested functions only as a compiler extension.

Q1835DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is true about passing arguments by reference in PHP functions?
  1. AArguments passed by reference cannot be modified within the function.
  2. BThe original value of the argument is changed when passed by reference.
  3. CPHP does not support passing arguments by reference.
  4. DArguments passed by reference must be of type array.
Show answerHide answer

Correct answer: (B) The original value of the argument is changed when passed by reference.

Explanation

In PHP, a parameter declared with & (function f(&$x)) is a reference to the caller's variable, so changing it inside the function changes the original value. Any type can be passed by reference.

Q1836DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is NOT a property of any algorithms?
  1. ASome of the algorithms may not produce even single quantity as an output.
  2. BEvery algorithm must produce at least one quantity as an output.
  3. CEach instruction of the algorithm must be clear and unambiguous.
  4. DFor all cases, the algorithm must terminate after finite number of instructions.
Show answerHide answer

Correct answer: (A) Some of the algorithms may not produce even single quantity as an output.

Explanation

Every algorithm must produce at least one output, have clear and unambiguous steps and terminate after finitely many steps. So "may not produce any output" is not a property of an algorithm.

Q1837DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Given the array a = [10, 20, 30, 40, 50, 60] with 6 elements, What will the array look like after inserting the value 45 at index 4?
  1. A[10, 20, 30, 40, 45, 50, 60]
  2. B[10, 20, 25, 30, 40, 45, 50]
  3. C[10, 20, 25, 30, 40, 45, 60]
  4. D[10, 25, 20, 30, 40, 45, 50]
Show answerHide answer

Correct answer: (A) [10, 20, 30, 40, 45, 50, 60]

Explanation

Inserting 45 at index 4 shifts 50 and 60 one place right, giving [10, 20, 30, 40, 45, 50, 60]. The other options contain 25, which was never in the array.

Q1838DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What is one common use of XML?
  1. ATo create dynamic websites
  2. BTo store data in a format that is readable by humans only
  3. CTo enhance the visual appearance of a webpage
  4. DTo represent and exchange data between different systems and platforms
Show answerHide answer

Correct answer: (D) To represent and exchange data between different systems and platforms

Explanation

XML is a platform-independent, self-describing text format used to store, represent and exchange structured data between different systems and applications. Presentation is the job of HTML/CSS.

Q1839DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What does the 'clone stamp' tool do in image editing?
  1. ADuplicates part of the image to another area
  2. BRemoves background
  3. CResizes the image
  4. DChanges the image color
Show answerHide answer

Correct answer: (A) Duplicates part of the image to another area

Explanation

The clone stamp copies (samples) pixels from one area of an image and paints them onto another area, often used to remove blemishes or duplicate objects.

Q1840DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is an application of the World Wide Web?
  1. ACreating software programs
  2. BSending emails directly to a mobile phone
  3. CBrowsing websites and accessing online services
  4. DStoring files on a computer
Show answerHide answer

Correct answer: (C) Browsing websites and accessing online services

Explanation

The World Wide Web is a system of linked web pages accessed through browsers, used for browsing websites and online services such as shopping, banking and searching.

Q1841DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Suppose there are 15 elements in the array that apply bubble sort technique to sort the elements of the array. What is the maximum number of comparisons, in worst case, required to sort the elements of array in ascending order?
  1. A120
  2. B210
  3. C105
  4. D225
Show answerHide answer

Correct answer: (C) 105

Explanation

Bubble sort makes (n-1) + (n-2) + ... + 1 = n(n-1)/2 comparisons in the worst case. For n = 15 that is 15 x 14 / 2 = 105.

Q1842DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is the correct way to declare a variable in Java?
  1. Alet x = 10;
  2. Bx = 10;
  3. Cvar x = 10;
  4. Dint x = 10;
Show answerHide answer

Correct answer: (D) int x = 10;

Explanation

Java is statically typed, so a variable is declared with its type: int x = 10;. let is JavaScript, and var x = 10 works only as local type inference from Java 10, so the standard answer is int.

Q1843DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Consider a singly linked list containing n elements in which A is the address of the starting node of the linked list. If we first convert the linked list to an array, then sort the array elements, and then create a new linked list from the elements of the sorted array, what is the number of operations required to traverse the linked list and store its data values ​in an additional array before applying sorting?
  1. AO(n log n)
  2. BO(log n)
  3. CO(n)
  4. DO(n²)
Show answerHide answer

Correct answer: (C) O(n)

Explanation

Copying the data needs a single pass through the list, visiting each of the n nodes once, so it takes O(n) operations. The later sorting step is what needs O(n log n).

Q1844DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which function is used to close a file in C?
  1. Aclose()
  2. Bfclose()
  3. Cflush()
  4. Dendfile()
Show answerHide answer

Correct answer: (B) fclose()

Explanation

fclose(fp) closes a file opened with fopen and flushes its buffers. close() is the low-level POSIX call on file descriptors, not the standard C file function.

Q1845DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following is an example of a vector graphic format?
  1. AJPG
  2. BPNG
  3. CGIF
  4. DSVG
Show answerHide answer

Correct answer: (D) SVG

Explanation

SVG (Scalable Vector Graphics) describes images with shapes and paths, so it scales without loss. JPG, PNG and GIF are raster (bitmap) formats.

Q1846DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which method is used to loop through all the enumerable properties of an object in JavaScript?
  1. AObject.values()
  2. BforEach()
  3. Cfor...in
  4. DObject.keys()
Show answerHide answer

Correct answer: (C) for...in

Explanation

The for...in loop iterates over all enumerable property names (keys) of an object. Object.keys() and Object.values() only return arrays, and forEach is an array method.

Q1847DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Suppose there are n elements in an array. If we want to delete the beginning element of an array, then how many shift operations are required to fill the gap left by the deleted element?
  1. An*(n − 1)/2
  2. Bn − 1
  3. C1
  4. Dn²
Show answerHide answer

Correct answer: (B) n − 1

Explanation

After deleting a[0], each of the remaining n - 1 elements must move one position left, so n - 1 shift operations are needed.

Q1848DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Consider the given memory representation of singly linked list where start points to the address of the starting node of the linked list, which is in memory location 0. Memory representation of the linked list Memory location | Item value | Pointer to next element 0 | A | 4 1 | E | 3 2 | B | NULL 3 | X | 2 4 | C | 1 If you traverse all the elements from the given linked list, then which of the following is correct order?
  1. AA, B, C, E, X
  2. BA, E, B, X, C
  3. CA, C, X, E, B
  4. DA, C, E, X, B
Show answerHide answer

Correct answer: (D) A, C, E, X, B

Explanation

Start at location 0 (A, next 4), then 4 (C, next 1), 1 (E, next 3), 3 (X, next 2), 2 (B, next NULL). So the order is A, C, E, X, B.

Q1849DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
Which of the following are key components of an XML document?
  1. ATags, attributes, and comments
  2. BHTML tags and hyperlinks
  3. CClasses, objects, and functions
  4. DScripts, styles, and images
Show answerHide answer

Correct answer: (A) Tags, attributes, and comments

Explanation

An XML document is made of elements (tags), attributes, text content, comments and a prolog/declaration. HTML tags, classes or scripts are not its components.

Q1850DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)
What will be the output of the following C program code if the file "test.txt" is empty, readable, and exists in the appropriate directory? #include <stdio.h> int main() { FILE *fp = fopen("test.txt", "r"); if (fp == NULL) { printf("Error\n"); } else { printf("Success\n"); fclose(fp); } return 0; }
  1. ASuccess
  2. BNULL
  3. CGarbage value
  4. DError
Show answerHide answer

Correct answer: (A) Success

Explanation

fopen in "r" mode succeeds for an existing readable file even if it is empty, so fp is not NULL and "Success" is printed. Emptiness only matters when reading data.

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