Docsity

MIS 315 Final Python Strings, Object-Oriented Programming, DataFrames, and Tokenization, Exams of Nursing

Toggle sidebar
bg1
MIS 315 Final Python Strings, Object-Oriented
Programming, DataFrames, and Tokenization
Comprehensive Practice Exam LATEST ALL VERSIONS
ACTUAL EXAM COMPLETE QUESTIONS AND CORRECT
DETAILED ANSWERS (VERIFIED ANSWERS) | ALREADY
GRADED A+ 2026/2027 WITH FREE PRACTICE TEST SETS
Section 1: Improved Original Questions
Question O1: Python provides a wide variety of tools and programming techniques that you can
use to __ and __ strings.
A. examine; manipulate
B. delete; compile
C. import; print
D. index; tokenize
- answers 100%✔✔✔ 📌A
Rationale: Python includes many string methods for examining and manipulating text.
Question O2: Strings use ___ to access individual characters.
A. slicing
B. indexing
C. concatenation
D. tokenization
- answers 100%✔✔✔ 📌B
Rationale: Indexing uses bracket notation to access a character by position.
Question O3: In Python strings are __ meaning that the first character has index __, the second
has index __, and so on.
A. one-indexed; 1; 2
B. zero-indexed; 0; 1
C. negative-indexed; -1; 0
D. mutable; 0; 1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23

Partial preview of the text

Download MIS 315 Final Python Strings, Object-Oriented Programming, DataFrames, and Tokenization and more Exams Nursing in PDF only on Docsity!

MIS 315 Final Python Strings, Object-Oriented

Programming, DataFrames, and Tokenization

Comprehensive Practice Exam LATEST ALL VERSIONS

ACTUAL EXAM COMPLETE QUESTIONS AND CORRECT

DETAILED ANSWERS (VERIFIED ANSWERS) | ALREADY

GRADED A+ 2026/2027 WITH FREE PRACTICE TEST SETS

Section 1: Improved Original Questions Question O1: Python provides a wide variety of tools and programming techniques that you can use to __ and __ strings. A. examine; manipulate B. delete; compile C. import; print D. index; tokenize

  • answers 100%✔✔✔ 📌A Rationale: Python includes many string methods for examining and manipulating text. Question O2: Strings use ___ to access individual characters. A. slicing B. indexing C. concatenation D. tokenization
  • answers 100%✔✔✔ 📌B Rationale: Indexing uses bracket notation to access a character by position. Question O3: In Python strings are __ meaning that the first character has index __, the second has index __, and so on. A. one-indexed; 1; 2 B. zero-indexed; 0; 1 C. negative-indexed; - 1; 0 D. mutable; 0; 1
  • answers 100%✔✔✔ 📌B Rationale: Python sequences are zero-indexed. Question O4: When iterating through a string with a while loop in Python, the loop continues until ___. A. a sentinel value is found B. the end of the string is reached C. the index equals 1 D. the string becomes mutable
  • answers 100%✔✔✔ 📌B Rationale: The loop stops when the index reaches the length of the string. Question O5: When iterating through a string with a while loop, you typically use ___ and ___ as the loop condition. A. the length of the string; an index variable B. split; join C. class; object D. startswith; endswith
  • answers 100%✔✔✔ 📌A Rationale: A common condition is index < len(string). Question O6: For string concatenation, Python uses the augmented assignment operator __. A. += B. - = C. *= D. /=
  • answers 100%✔✔✔ 📌A Rationale: += appends the right string to the left string variable. Question O7: Strings are ___. A. mutable B. immutable C. both mutable and immutable D. neither
  • answers 100%✔✔✔ 📌B Rationale: Existing string characters cannot be changed in place.

B. whitespace C. period D. tab only

  • answers 100%✔✔✔ 📌B Rationale: str.split() splits on any whitespace by default. Question O13: ___ programs concentrate on creating objects which are instances of classes. A. Procedural B. Object-oriented C. Functional D. Modular
  • answers 100%✔✔✔ 📌B Rationale: Object-oriented programming centers on objects and classes. Question O14: The procedures an object performs are called ___. A. methods B. attributes C. classes D. modules
  • answers 100%✔✔✔ 📌A Rationale: Methods are functions defined inside a class. Question O15: ___ refers to combining data and code into a single object. A. Encapsulation B. Inheritance C. Polymorphism D. Tokenization
  • answers 100%✔✔✔ 📌A Rationale: Encapsulation bundles data and methods together. Question O16: ___ refers to restricting access to certain details of an object and only exposing what is necessary. A. Data hiding B. Slicing C. Indexing D. Concatenation
  • answers 100%✔✔✔ 📌A Rationale: Data hiding protects internal object state. Question O17: A(n) ___ is not a stand-alone program; it is used by programs that need its services. A. object B. operating system C. compiler D. spreadsheet
  • answers 100%✔✔✔ 📌A Rationale: Objects are used by programs and are not standalone applications. Question O18: A ___ is code that specifies the data attributes and methods for a particular object. A. class B. string C. list D. dataframe
  • answers 100%✔✔✔ 📌A Rationale: A class is a blueprint for objects. Question O19: Each object that is created from a class is called an ___ of the ___. A. instance; class B. class; instance C. method; object D. attribute; method
  • answers 100%✔✔✔ 📌A Rationale: An object is an instance of a class. Question O20: A blueprint or template for creating objects, but it does not provide the main body of the program’s execution, is a ___. A. class B. function C. module D. loop
  • answers 100%✔✔✔ 📌A Rationale: A class defines structure but is not the program entry point.
  • answers 100%✔✔✔ 📌A Rationale: Password validation checks string content and format. Question O26: How does a for loop know to stop? A. When the sequence is exhausted B. When a sentinel blank always appears C. When the index equals 1 D. When the string becomes mutable
  • answers 100%✔✔✔ 📌A Rationale: A for loop stops after all items in the sequence are processed. Question O27: You must use ___ when iterating a string with a while loop. A. len B. split C. join D. upper
  • answers 100%✔✔✔ 📌A Rationale: len() gives the stopping condition for the index. Question O28: You (can/can’t) edit a string. A. can B. can’t C. only with append D. only with replace in place
  • answers 100%✔✔✔ 📌B Rationale: Strings are immutable, so they have no append method. Question O29: How do you edit a string? A. Delete the old string and replace it with a new string B. Use append C. Change a character by index D. Use pop
  • answers 100%✔✔✔ 📌A Rationale: Because strings are immutable, editing creates a new string. Question O30: String slicing is done by __. They start with ___. Negative indexing starts with ___.

A. index number; 0; - 1 B. position; 1; - 0 C. token; 0; 1 D. length; - 1; 0

  • answers 100%✔✔✔ 📌A Rationale: Slices use index numbers; positive indexes start at 0, negative at - 1. Question O31: String splitting will by default split on ___. A. spaces/whitespace B. commas C. periods D. digits
  • answers 100%✔✔✔ 📌A Rationale: split() uses whitespace when no delimiter is given. Question O32: What do you get after splitting? A. a list B. a string C. a tuple D. an integer
  • answers 100%✔✔✔ 📌A Rationale: split() returns a list of substrings. Question O33: T/F: You can’t string split on characters other than spaces. A. True B. False C. Only on tabs D. Only on newlines
  • answers 100%✔✔✔ 📌B Rationale: You can pass a delimiter such as split(","). Question O34: You must convert string data into __ or __ to calculate. A. int/float B. list/tuple C. class/object D. bool/str

Question O39: What will this give you? if filename.endswith('.txt'): A. text file B. python file C. word file D. image file

  • answers 100%✔✔✔ 📌A Rationale: .txt usually indicates a text file. Question O40: What will this give you? if filename.endswith('.py'): A. python file B. text file C. word file D. image file
  • answers 100%✔✔✔ 📌A Rationale: .py indicates a Python file. Question O41: What will this give you? if filename.endswith('.doc'): A. word file B. python file C. text file D. image file
  • answers 100%✔✔✔ 📌A Rationale: .doc indicates a Word document. Question O42: What statement will show/test the first word of a statement? A. .startswith() B. .endswith() C. .split() D. .find()
  • answers 100%✔✔✔ 📌A Rationale: .startswith() tests a prefix. Question O43: T/F: .startswith and .endswith are case sensitive. A. True B. False C. Only startswith D. Only endswith
  • answers 100%✔✔✔ 📌A Rationale: Case matters unless the string is normalized. Question O44: T/F: When you do a replace, it will replace just the first instance. A. True B. False C. Only if count= D. Only strings
  • answers 100%✔✔✔ 📌B Rationale: str.replace() replaces all occurrences by default. Question O45: Making each sentence a list element is called ___. A. Sentence tokenization B. Word tokenization C. Data framing D. Indexing
  • answers 100%✔✔✔ 📌A Rationale: Sentence tokenization splits text into sentences. Question O46: Each word is a list element in ___. A. Word tokenization B. Sentence tokenization C. Slicing D. Data hiding
  • answers 100%✔✔✔ 📌A Rationale: Word tokenization splits text into words. Question O47: A two-dimensional data structure like rows and columns, like a spreadsheet, is a ___. A. data frame B. string C. tuple D. class
  • answers 100%✔✔✔ 📌A Rationale: A DataFrame has rows and columns.

D. an error

  • answers 100%✔✔✔ 📌A Rationale: Python uses the string length as the effective end. Question O53: T/F: Indexing of a string starts at 1, so the index of the first character is 1, the index of the second character is 2, and so forth. A. True B. False C. Only in Python 2 D. Only for lists
  • answers 100%✔✔✔ 📌B Rationale: Python indexing starts at 0. Question O54: Which method would you use to determine whether a certain substring is present in a string? A. find(substring) B. append(substring) C. pop(substring) D. delete(substring)
  • answers 100%✔✔✔ 📌A Rationale: find() returns the position or - 1 if not found. Question O55: What will be the value of the variable string after this code executes? string = 'abcd'; string = string.upper() A. 'Abcd' B. 'ABCD' C. 'abcd' D. Nothing; this code is invalid
  • answers 100%✔✔✔ 📌B Rationale: .upper() returns a new uppercase string. Section 2: Additional 100 Questions Question A1: What does len("MIS315") return? A. 5 B. 6 C. 7

D. Error

  • answers 100%✔✔✔ 📌B Rationale: len() counts all characters, including digits. Question A2: What is "Hello"[1]? A. H B. e C. l D. o
  • answers 100%✔✔✔ 📌B Rationale: Index 1 is the second character. Question A3: What is "Hello"[-1]? A. H B. e C. l D. o
  • answers 100%✔✔✔ 📌D Rationale: Negative indexing starts from the end. Question A4: What does "Python"[0:4] return? A. Pyth B. Pytho C. ytho D. Python
  • answers 100%✔✔✔ 📌A Rationale: The slice includes indexes 0–3. Question A5: What does "Python"[2:] return? A. Py B. thon C. th D. ython
  • answers 100%✔✔✔ 📌B Rationale: The slice starts at index 2 and goes to the end.
  • answers 100%✔✔✔ 📌A Rationale: upper() returns an uppercase copy. Question A11: Which method removes leading and trailing whitespace? A. strip() B. split() C. find() D. replace()
  • answers 100%✔✔✔ 📌A Rationale: strip() removes whitespace from both ends. Question A12: Which method returns the index of a substring or - 1? A. find() B. index() C. search() D. locate()
  • answers 100%✔✔✔ 📌A Rationale: find() returns - 1 if not found. Question A13: Which method splits a string into a list? A. split() B. join() C. slice() D. strip()
  • answers 100%✔✔✔ 📌A Rationale: split() returns a list of substrings. Question A14: Which method joins list elements into a string? A. join() B. split() C. concat() D. append()
  • answers 100%✔✔✔ 📌A Rationale: join() combines an iterable of strings. Question A15: What does "a,b,c".split(",") return? A. ['a','b','c']

B. 'a b c' C. ('a','b','c') D. ['a,b,c']

  • answers 100%✔✔✔ 📌A Rationale: Splitting on comma creates three elements. Question A16: What does ",".join(['a','b']) return? A. 'a,b' B. 'ab' C. ['a,b'] D. 'a b'
  • answers 100%✔✔✔ 📌A Rationale: join() inserts the comma between elements. Question A17: What does "abc".isdigit() return? A. True B. False C. Error D. None
  • answers 100%✔✔✔ 📌B Rationale: abc contains letters, not digits. Question A18: What does "123".isdigit() return? A. True B. False C. Error D. None
  • answers 100%✔✔✔ 📌A Rationale: All characters are digits. Question A19: What does "abc".isalpha() return? A. True B. False C. Error D. None
  • answers 100%✔✔✔ 📌A Rationale: All characters are letters.
  • answers 100%✔✔✔ 📌A Rationale: Case matters unless strings are normalized. Question A25: What does "Hello".startswith("he") return? A. True B. False C. Error D. None
  • answers 100%✔✔✔ 📌B Rationale: The first letter is uppercase H. Question A26: What does "file.txt".endswith(".txt") return? A. True B. False C. Error D. None
  • answers 100%✔✔✔ 📌A Rationale: The string ends with .txt. Question A27: What does "banana".replace("a","o") return? A. bonono B. banono C. bonona D. banana
  • answers 100%✔✔✔ 📌A Rationale: All a characters are replaced with o. Question A28: Does replace() replace all occurrences by default? A. Yes B. No C. Only first D. Only last
  • answers 100%✔✔✔ 📌A Rationale: Default behavior replaces every match. Question A29: What does "Hello".lower() return? A. hello

B. HELLO

C. Hello D. hELLO

  • answers 100%✔✔✔ 📌A Rationale: lower() returns lowercase. Question A30: What does "Hello".upper() return? A. HELLO B. hello C. Hello D. hELLO
  • answers 100%✔✔✔ 📌A Rationale: upper() returns uppercase. Question A31: What is a substring? A. A contiguous slice of a string B. A class C. A method D. A dataframe
  • answers 100%✔✔✔ 📌A Rationale: A substring is part of a string. Question A32: What does "abcde"[1:4] return? A. bcd B. bcde C. abcd D. cde
  • answers 100%✔✔✔ 📌A Rationale: Indexes 1, 2, and 3 are included. Question A33: What does "abcde"[-3:] return? A. cde B. abc C. de D. bcde
  • answers 100%✔✔✔ 📌A Rationale: The last three characters are cde.