Ugrás a fő tartalomra

Kérdés/Válasz : Python angol 1

  Saját gyűjteményem gyöngy szemei. Csak saját felelősségre használd.   Link

Pearl eyes from my own collection. Use at your own risk.  







Which of the following would be good names for variables? Choose two.
UserId
AccountNo
----
Fill in the blank. The mathematic operation module (%) gives you the                             of a division.
remainder
---
Match the abbreviations for setting the date format to the description.
%Y is for Year
%d is for day
%b is for month
----
If IntelliSense is not prompting you with a function, you may need to _____________ your variable. Choose one.
Initialize
----
Choose one. When asking your user to input a date how do you make sure they enter in the format you want?
-
Tell the user the format to enter
----
Choose one. What does the date 12/06/09 represent?
Depends on the format you are using
----
Fill in the blank. The ___________ function is used for getting user input. Type the correct answer into the text box.
-
input()
----
What is the keyboard short cut for launching your program with Debugging
F5
---
Fill in the blank. print(), .lower() and .upper() are all different _____________ you can use in python. Type the correct answer into the text box.
-
Methods
---
----
You have created a variable call message containing the text “Hello World” and wish to print it out in all upper case, which is the right line to do so? Choose one.
print(message.upper())
----
You can set the time format the same as setting dates format. You will find a list of abbreviations for using in the strftime function on the website _________. Choose one
-
strftime.org
----
True or False: You can use reserved words such as print for variable names.
False
----
In Python you can use triple quotes to enclose your text in the print statement to have your text display as you have typed into the editor. Why is this not a recommended method? Choose one.
-
most other programming languages don’t support it.
----
There are some rules when naming variables. Choose three of these from the following list.
-
Cannot start with a number
You can’t have spaces
Variables are case sensitive
----
Choose two recommended methods to help fix mistakes you can’t find or resolve in your code.
Have another coder look at it.
Walk away and come back to it.
----
True or False: You cannot change the font colour of your comments in visual studio.
False
----
For creating a new Python project in Visual Studio, you have several different options for the version of python. Which was the version that you were taught to create in the presentation? Choose one.
Python Project
----
Fill in the blank. Fundamentals of one programing language are the same as other programming languages with the  ______________ being the main difference. Type the correct answer into the text box.
-
syntax
----
Fill in the blank. For commenting in a block of code using keyboard shortcuts you highlight the block and press ctrl k + _______.
-
keyboard shortcuts
----
There are a lot of different versions of Python that you could use, select three versions from the following list:
Jython
IronPython
Anaconda
----
Choose one. Which is the right method for declaring a numeric variable?
-
FirstNumber = 20
----
Choose one. What is the mathematic operation for multiplication?
*
----
Fill in the blank. For adding a numeric variable to a string in your print statement you need to put in a __________ holder for the value displaying.
+
----
Fill in the blank. Visual Studio Express is a ____________ version of Visual Studio. Type the correct answer into the text box.
free
----
IntelliSense will only prompt you after you have typed what character? Choose one.
.
----
Fill in the blank. Saving numeric variables as decimal/integer types is for storing ______________ numbers.
Variable
----
True or False: Python allows you to use single and double quotes to enclose the text in your print statement.
True
--
What is a place that is recommended for you to nearly always use a try/ except block? Choose one.
Opening files
----
Choose two recommended methods to help fix mistakes you can’t find or have resolving in your code.
Have another coder look at it.
Walk away and come back to it.
----
Fill in the blank. To have your function give back a value, variable, etc. you use the ___________ statement at the end of the function. Type the correct answer into the text box.
return
---
Fill in the blank. When using an if statement and you want to execute a different line of code if your condition is not true you would use an ___________ statement at the end. Type the correct answer in the text box.
else
----
You should always make sure your variables have ________ names. Choose one.
Meaningful
--
Fill in the blank. To use the turtle functions in your program you need to ____________ the turtle library into your program. Type the correct answer in the text box.
import
---
What is the first number the following block of code will print out? Write your answer in numeric form in the box provided. 
For steps in range(4)
Print(steps)
-
0
-----
True or False: You can put your functions in a separate file and import the file to use those functions in your main file.
True
----
When you create a variable and assign it a value e.g. (NewVar = 20) this is called _________ your variable. Choose one.
-
Initializing
----
True or False: You can call a function inside a function.
True
----
True or False: A list in python can only store one data type at a time.
False
----
How many times is the second for loop going to loop in this block of code? Write your answer in numeric form in the box provided. 
for steps in range(5):
turtle.forward(100)
turtle.right(90)
for moresteps in rage(4):
turtle.forward(50)
turtle.right(90)
4 nem jó /// legyn a 3 !!
----
Fill in the blank. A Boolean variable holds a ___________ value.
-
True or False
----
What function can you use if you want to find out or display what error occurred? Choose one.
-
sys.exc_info()
----
Fill in the blank. For creating a new function you use the key word __________. Type the correct answer into the text box.
def
----
True or False: You can’t reuse variable names in different functions.
-
False
----
Choose one. To read a single line from a file, what function would you use?
-
.readline()
----
When specifying access mode in creating a file w stands for a writeable file, what letter stands for appending?
a
----
Choose one. If you want to remove an item from the fourth position in your list but you don’t know the value of that item you removed, which of the following would you use?
-
del list[3]
----
In python you can specify exactly what the values you use in your loops range. Which is the right method for this? Choose one.
-
for steps in [1,2,3,4,5]
-----
Choose three. Why create functions?
-
Simplifying your code
Code reuse
Easier to make changes
----
What would the following for loop print on the third time it loops?
For steps in range(1,10,2)
Print(steps)
5
----
True or False: You would use the same method to open a file to read from as you would for creating it, except for changing the access mode to read.
True
----
Choose one. To sort your list in python, what would you use?
-
Sort function
----
Fill in the blank. The csv in a csv file stands for ___________ separated values.
comma
----
Fill in the blank. To find out the length of your list, you would use the ___________ function.
len
----
Writing to an existing file will ___________ the data in the file. Choose one.
-
Replace
----
True or False: You can put your functions in a separate file and import the file to use those functions in your main file.
True
----
True or False: Python allows you to count your lists backwards.
True
----
What is a place that is recommended for you to nearly always use a try/ except block? Choose one.
-
Opening files
----
True or False: In python when using if statements if your code is not indented under the if statement it will not be included in the if statement.
True
----
True or False: Almost every if statement can only be written one way.
-
False
----
Choose one. What is this block of code missing to function properly?
If country == “Ireland” and pet == “cat” or pet == “dog”:
-
All of the if statement should be in parentheses
----

















Megjegyzések