Python Programming
QUESTION 16
Which of the following is an example of a Keyword in Python?
elif |
||
class |
||
for |
||
All of the above |
QUESTION 17
Which of the following is not an acceptable variable name in Python?
2ndVar |
||
$amount |
||
Rich& ard |
||
None of the above are acceptable variable names |
QUESTION 18
The number 1 rule in creating programs is ___________________-
Write the code first |
||
Think before you program |
||
Let the compiler find you syntax errors |
||
There are no rules just go for it |
QUESTION 19
A set is a collection of objects, a set with no objects is called the "null" set.
True
False
QUESTION 20
Files fall into two broad categories; text files and graphic files.
True
False
QUESTION 21
List methods come in three categories; those that change the list, those that do not change the list, and those that return a value.
True
False
QUESTION 22
Tuples and Lists are both immutable.
True
False
QUESTION 23
The \n characters in a Python print statement will cause ___________
the carriage return to skip 5 spaces |
||
the carriage return to skip to the next line |
||
the carriage return to print non-printing characters |
||
All of the above |
QUESTION 24
The continuation character to continue a line in Python is represented by the __________ symbol.
\ |
||
/ |
||
* |
||
% |
QUESTION 25
The symmetric difference operator of a set is the ^ operator.
True
False
QUESTION 26
When using files if you misspell the file name, Python will look into the directory to find the correct spelling.
True
False
QUESTION 27
A method is a function that works with a particular type of Python object.
True
False
QUESTION 28
Which of the following statements opens a file for writing?
file_handle = open("file_name", "w") |
||
file_handle = open("file_name", "r") |
||
file_handle = open("file_name", "o") |
||
file_handle = open("file_name", "x") |
QUESTION 29
Once a file is open you can print to the file by adding the file=argument to the print command.
True
False
QUESTION 30
The sort method works only with strings.
True
False
16 ans:
option D is correct which is All of the above
because elif class for these three are also keywords in the python
17 ans:
option D is correct which is None of the above are acceptable variable names
because variable not start with number and not start with $ and not contain any specail characeters except underscore
18 ans:
option B is correct Think before you program
because while we write any program first we must think what we write
19 ans:
True
because we can able to call either null set or empty set
20 ans:
True
because all file come into text files and another one goes to graphic files
21 ans:
False
beause lot of methods python lise append,extent,remove,insert,reverse like lot of there so not 3
22 ans:
False
because touples only immutable and lists are mutable
23 ans:
the carriage return to skip to the next line
24 ans:
option A is correct which is \
25 ans:
True
26 ans:
False
because if file spell incorrect it raises an error
27 ans:
True
28 ans:
option A is correct which is
file_handle = open("file_name", "w")
29 ans:
True
30 ans:
False
because sort can work event numeric data too
#if you have any doubt or more information needed comment below..i will respond as possible as soon...thanks..
Python Programming QUESTION 16 Which of the following is an example of a Keyword in Python?...
Python Programming The strip() method allows you to __________________. remove characters insert characters replace characters none of the above QUESTION 2 Text files contain Unicode characters and are human readable. True False QUESTION 3 Passing mutable objects does not allow a function to change values in the calling program. True False QUESTION 4 Python uses an _______________ to execute each line of code one at a time. compiler interpreter engraver importer QUESTION 5 The Intersection operator for a set is...
What will be printed upon running following code: alist = [3, 50, "Kity", [50, 52, "Rover"], [ ], 3.14, False, 'a'] print(len(alist[3]))alist = [3, 50, "Kity", [50, 52, "Rover"], [ ], 3.14, False, 'a'] print(len(alist[3])) 8 7 2 an error 3 Select the best reason why the code below returns True, False, False respectively? a = 256 b = 256 print(id(a) == id(b)) c = 5.1 d = 5.1 print(id(c) == id(d)) x = 257 y = 257 print(id(x) ==...
PYTHON please help! im stuck on this homework question, THANK YOU! please follow the rules! Give a recursive python implementation of the following function: def check_Decreasing_Order(lissy): Given lissy, a python list of integers, the above function will return True if lissy is sorted in decreasing order, otherwise it will return false. For example, print(check_Decreasing Order([100,50,8, -2])) True print(check_Decreasing_Order([108,50,8,2,35])) False Implementation Requirements: 1. Your implementation must be recursive. 2. If you need more parameters, you may define new functions or helper...
Encoding and Decoding PPM image 3 & 4 are parts of question 2 Code for a09q1: We were unable to transcribe this image3 Encoding an Image in a09q2.py In the next four sections, you will no longer write class methods but rather functions. In each of the next four parts, you should be importing the PPM class from a09q1.py to use with the command from a09q1 import PPM Note that this is similar to how the check module was imported...
Hello I need help with python programming here is my code # Trivia Challenge # Trivia game that reads a plain text file import sys def open_file(file_name, mode): """Open a file.""" try: the_file = open(file_name, mode) except IOError as e: print("Unable to open the file", file_name, "Ending program.\n", e) input("\n\nPress the enter key to exit.") sys.exit() else: return the_file def next_line(the_file): """Return next line from the trivia file, formatted.""" line = the_file.readline() line = line.replace("/", "\n") return line def next_block(the_file):...
PYTHON this implementation is really hard, Im stuck especially with the requirements they give. PLEASE HELP! THANK YOU! RECURSIVE! Give a recursive python implementation of the following function: def check_Decreasing_Order(lissy): Given lissy, a python list of integers, the above function will return True if lissy is sorted in decreasing order, otherwise it will return false. For example, print(check_Decreasing Order([100,50,8, -2])) True print(check_Decreasing_Order([108,50,8,2,35])) False Implementation Requirements: 1. Your implementation must be recursive. 2. If you need more parameters, you may define...
Help needed related python task ! Thanx again How you're doing it • Write a function write_to_file() that accepts a tuple to be added to the end of a file o Open the file for appending (name your file 'student_info.txt') o Write the tuple on one line (include any newline characters necessary) o Close the file • Write a function get_student_info() that o Accepts an argument for a student name o Prompts the user to input as many test scores...
1) Which of the following is NOT true about a Python variable? a) A Python variable must have a value b) A Python variable can be deleted c) The lifetime of a Python variable is the whole duration of a program execution. d) A Python variable can have the value None. 2) Given the code segment: What is the result of executing the code segment? a) Syntax error b) Runtime error c) No error d) Logic error 3) What...
QUESTION 21 while True: , in Python, can be used to create an infinite loop. True False 2 points QUESTION 22 The Python Framework does inform you where an error occurred True False 2 points QUESTION 23 ____ is a critical component to being able to store data and information long term. File Access Memory Print function with 2 points QUESTION 24 Error handling is also known as ___ handling Result Recursion Exception Crash 2 points ...