Exam 3: Codes and Other Secrets: String Operators and Methods, the Len Built-In Function, Keyword Parameters, User Input

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What is the [:] operator called?

(Multiple Choice)
4.7/5
(35)

Match each line of code with a result below. Assume aString is initialized as below: aString = "golden gopher football" -aString.find('b')

(Multiple Choice)
4.8/5
(28)

What is the operator represented by the * in the following code? Explain its use. >>> 'go'*3

(Essay)
4.7/5
(47)

What is the string concatenation operator in Python?

(Multiple Choice)
4.9/5
(37)

Match each line of code with a result below. Assume aString is initialized as below: aString = "golden gopher football" -aString.count('oo')

(Multiple Choice)
4.8/5
(31)

What does the term "string" refer to in computer science language, and how is a string defined in Python?

(Essay)
4.8/5
(42)

Case Study 2: 1. def scramble2Encrypt(plainText): 2. evenChars = "" 3. oddChars = "" 4. charCount = 0 5. for ch in plainText: 6. if charCount % 2 == 0: 7. evenChars = evenChars + ch 8. else: 9. oddChars = oddChars + ch 10. charCount = charCount + 1 11. cipherText = oddChars + evenChars 12. return cipherText -Refer to the code in the accompanying case study 2. What is the name of the % operator used on line 6?

(Multiple Choice)
4.9/5
(37)

What is the advantage of a substitution cipher over a transposition cipher?

(Essay)
4.8/5
(37)

What method can be used to surround a string with spaces in order to make it a certain length?

(Multiple Choice)
4.8/5
(34)

How effective is a brute force approach to cracking a substitution cipher? Explain your answer.

(Essay)
4.8/5
(43)

What function converts a character to its Unicode equivalent?

(Multiple Choice)
4.8/5
(40)

Case Study 2: 1. def scramble2Encrypt(plainText): 2. evenChars = "" 3. oddChars = "" 4. charCount = 0 5. for ch in plainText: 6. if charCount % 2 == 0: 7. evenChars = evenChars + ch 8. else: 9. oddChars = oddChars + ch 10. charCount = charCount + 1 11. cipherText = oddChars + evenChars 12. return cipherText -Refer to the code in the accompanying case study 2. What type of cipher has been implemented?

(Multiple Choice)
5.0/5
(34)

Describe the functionality of the string index operator with an example.

(Essay)
4.7/5
(33)
Showing 21 - 33 of 33
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)