Back to marketplace

Software DD (Implementation: String Handling)

No description yet. This curated deck is ready for daily study.

Total cards: 15•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (15)

#1
Front (Question)

What would be the output of this code? mystring = “The quick brown fox jumps over the lazy dog” print(mystring[2])

Back (Answer)

e

#2
Front (Question)

What would be the output of this code? mystring = “The quick brown fox jumps over the lazy dog” print(mystring[0:3])

Back (Answer)

The

#3
Front (Question)

What would be the output of this code? original =”I am a string” print(original[2:4])

Back (Answer)

am

#4
Front (Question)

What would be the output of this code? original =”I am a string” print(original[7:len(original)])

Back (Answer)

string

#5
Front (Question)

What would be the output of this code? original =”I am a string” print(original[0:4])

Back (Answer)

I am

#6
Front (Question)

What would be the output of this code? original =”I am a string” print(original[-4])

Back (Answer)

r

#7
Front (Question)

What would be the output of this code? original =”I am a string” print(original[-6:])

Back (Answer)

string

#8
Front (Question)

What would be the output of this code? original = “This string is my original” print(original[0:3:2])

Back (Answer)

Gives us the following output - as Python will print the characters from position 0 to before position 3 but increasing the position by 2 each time. So will print out the characters at position 0 and 2. Ti

#9
Front (Question)

What would be the output of this code? original = “This string is my original” print(original[::-1])

Back (Answer)

lanigiro ym si gnirts sihT Generic method: original = “This string is my original” newstring = “” for x in range(len(original)-1,-1,-1): newstring += original[x] print (newstring)

#10
Front (Question)

Convert string into an ASCII Value

Back (Answer)

use ord() Example: character = ord(“a”) print(character) Output: 97

#11
Front (Question)

Convert ASCII Value to a string

Back (Answer)

use chr() Example: character = chr(65) print(character) Output: A

#12
Front (Question)

Example problem from RGC Aberdeen website: So we can use this to generate a random value between 65 and 90 and then grab the corresponding ASCII value to generate a random uppercase character such as below. This could be a useful technique for generating passwords etc.

Back (Answer)

import random character = chr(random.randint(65,90))

#13
Front (Question)

What does the modulus function do?

Back (Answer)

The modulus function or operator gives the remainder of a division. In some languages it is accessed by a predefined function but in Python is performed using the % operator

#14
Front (Question)

What would be the output of this code? remainder = 10 % 3 print(“Remainder = “ + str(remainder))

Back (Answer)

Remainder = 1

#15
Front (Question)

What does int() do?

Back (Answer)

My Summary: Converts a real number to an integer. Unlike round() it doesn’t round the real number, int() simply cuts the mantissa off so int(6.833333333) would equal 6