DSSSB TGT Computer Science: String Manipulation Quiz & Previous Year Questions (PYQs)

Preparing for the DSSSB TGT Computer Science Exam? Strings and String Manipulation form a core component of the technical syllabus—appearing consistently across Python, C, C++, and Java programming questions in 2017, 2021, 2023, and 2024.

Test your concepts with this interactive, year-wise solved quiz designed strictly according to the latest DSSSB exam patterns.

💡 Key Concepts Covered in this Quiz

  • Python String Slicing & Immutability (Asked in 2023 & 2024)
  • C-Language String Functions & Memory Allocation (Asked in 2021)
  • Java String Pool vs Object Reference (Asked in 2017)
  • String Formatting & Standard Library Methods (Asked in 2024)

🎮 Interactive Quiz: String Questions (DSSSB TGT CS PYQs)

Select your answer for each question to get immediate feedback and detailed explanations!

DSSSB TGT CS — 07 Feb 2024 (Shift 2)

Q1. What will be the output of the following Python code snippet?
s = "DSSSB EXAM"
print(s[::-1])

Explanation: In Python string slicing s[start:stop:step], a negative step value of -1 reverses the string character by character. Hence, "DSSSB EXAM" becomes "MAXE BSSSD".
DSSSB TGT CS — 25 June 2023

Q2. Which of the following statements about Python strings is TRUE regarding immutability?

Explanation: Strings in Python are immutable. Any operation that modifies a string (like concatenation or replace()) creates and returns a new string object. Attempting str[0] = 'X' raises a TypeError.
DSSSB TGT CS — 07 Aug 2021

Q3. In C programming, what will be the output of strlen(str) and sizeof(str) for char str[] = "DELHI";?

Explanation: strlen() counts the number of characters excluding the null terminator (\0), returning 5. However, sizeof() returns total memory allocated in bytes including the trailing \0, giving 6 bytes.
DSSSB TGT CS — 07 Feb 2024 (Shift 2)

Q4. What is the output of the following Python expression?
len("DSSSB TGT Computer Science".split())

Explanation: The .split() method without arguments splits the string by whitespace into a list of words: ['DSSSB', 'TGT', 'Computer', 'Science']. The len() function counts elements in this list, which equals 4.
DSSSB TGT CS — 21 May 2017

Q5. In Java, what is the evaluation of s1 == s2 versus s1.equals(s2) when declared as:
String s1 = new String("TGT"); String s2 = new String("TGT");?

Explanation: Using new String() forces memory allocation on the heap, so s1 and s2 point to different memory references. Thus, reference comparison s1 == s2 yields false, while value comparison s1.equals(s2) yields true.
DSSSB TGT CS — Model Practice Question

Q6. What will be the output of the following Python program?
text = "DSSSB2024"
print(text[1:7:2])

Explanation: In Python string slicing text[start:stop:step]:
  • start = 1 (character at index 1 is 'S')
  • stop = 7 (slice goes up to, but excludes, index 7)
  • step = 2 (takes every 2nd character)
Indices picked: 1 ('S'), 3 ('S'), 5 ('B'). Therefore, the output is SSB.

📚 Essential Revision Notes: Strings for DSSSB TGT CS

1. Python Strings Key Facts

  • Immutability: Modifying a string creates a new instance.
  • Slicing Syntax: string[start : stop : step]. Negative steps reverse indexing.
  • Common Functions: strip() removes whitespace, join() merges sequences, and find() returns index or -1 if not found.

2. C / C++ String Memory Rules

  • C strings are null-terminated character arrays ending with \0.
  • sizeof(arr) includes the \0 byte; strlen(arr) excludes it.
  • In C++, std::string dynamically resizes and supports the + operator for concatenation.

❓ Frequently Asked Questions (FAQs)

Q1. How many questions on Strings are asked in the DSSSB TGT CS exam?

Typically, 3 to 5 questions directly target string manipulation, indexing, function evaluation, or memory representation across Python and C/C++ sections.

Q2. Which programming language is most important for DSSSB TGT Computer Science?

Recent exam trends (2021–2024) show a heavy weightage toward Python 3, followed by C++ OOPs concepts and foundational C programming.

Q3. What is the negative marking scheme in DSSSB TGT CS?

DSSSB applies a negative marking of 0.25 marks for every incorrect response in section B (Technical Subject Domain).

FREE STUDY MATERIAL

DSSSB TGT CS: String Manipulation Revision Notes

Includes year-wise PYQs (2017–2024), Python & C string trick questions, and quick formula sheets.

Post a Comment

Please do note create link post in comment section

Previous Post Next Post