Deck 1: Basic Python Programming
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/51
العب
ملء الشاشة (f)
Deck 1: Basic Python Programming
1
In Python, _MyVar15 is a valid variable name.
True
2
Strings are mutable objects, which means you can replace their contents.
False
3
In Python, a variable containing the value 5 will evaluate as true if used with the and logical operator.
True
4
The print function outputs a newline by default before its arguments are printed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
5
If you print the string "Hello, it is a very \nice day", there will be two lines of output.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
6
Strings are compared using ASCII ordering.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
7
A docstring is another term for a Python variable that holds a string constant.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
8
The keywords True and False are floating point values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
9
It is good practice to import all names from a module using the * operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
10
Use the comparison operator != to check if one value is not equal to another value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
11
You can use the # symbol to create a multiline comment.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
12
Python programs require two or more modules.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
13
The keyword while means the same thing as While in Python.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
14
To make your program more secure, use obscure variable names such as xz14dEEa .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
15
Indenting code that should be executed when an if statement evaluates as true makes your program easier to read, but the indentation is not necessary.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
16
The while statement uses the syntax while : and is the preferred control statement to iterate over a definite range of sequences.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
17
Standard functions and Python's library functions check the types of their arguments when the function is called.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
18
The input function returns a numeric value by default.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
19
You can use the slice operator to obtain a substring from a string.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
20
The main python module contains the starting point of execution.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
21
To create an end-of-line comment, which symbol do you use to begin the comment?
A) #
B) *
C) /
D) @
A) #
B) *
C) /
D) @
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
22
With what character does the print function terminate its output by default?
A) newline
B) null
C) period
D) space
A) newline
B) null
C) period
D) space
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
23
A list mutator is a method used to modify the contents of a list.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
24
The expression primes = (2, 3, 5, 7, 11) creates a list named primes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
25
What can you use a docstring for?
A) to hold the name of a document file
B) to create a large string variable
C) to hold data of type string
D) to create a multiline comment
A) to hold the name of a document file
B) to create a large string variable
C) to hold data of type string
D) to create a multiline comment
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
26
What keywords does Python use for Boolean values?
A) Yes, No
B) On, Off
C) True, False
D) Set, Unset
A) Yes, No
B) On, Off
C) True, False
D) Set, Unset
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
27
Which statement allows a programmer to run a module as a standalone program or import it from the shell?
A) do _module(main)
B) while main != _module
C) if self == "main()":
D) if __name__ == "__main__":
A) do _module(main)
B) while main != _module
C) if self == "main()":
D) if __name__ == "__main__":
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
28
Which statement is true about Python syntax?
A) a code block must begin with a left brace
B) each code statement must end with a semicolon
C) white space is ignored
D) blocks of code are indicated by indentation
A) a code block must begin with a left brace
B) each code statement must end with a semicolon
C) white space is ignored
D) blocks of code are indicated by indentation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
29
What keyword is used to make a multiway if statement?
A) else
B) elif
C) then
D) elseif
A) else
B) elif
C) then
D) elseif
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
30
A literal representation of a list is made using parentheses to enclose items separated by commas.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
31
A tuple is an immutable sequence of items and does not have mutator methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
32
What symbol is used to insert a tab in a string?
A) \t
B) [ TAB ]
C) / t
D) @ tab
A) \t
B) [ TAB ]
C) / t
D) @ tab
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which comparison operation returns True if variable x is not equal to variable y?
A) x .ne. y
B) x neq y
C) x <> y
D) x != y
A) x .ne. y
B) x neq y
C) x <> y
D) x != y
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
34
A dictionary object contains zero or more entries where each entry associates a unique key with a value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
35
What is the output of the following code?
Sum = 0
For value in range(1,4):
If value == 2:
Sum = sum**2
Sum += value
Print(sum)
A) 6
B) 12
C) 8
D) 16
Sum = 0
For value in range(1,4):
If value == 2:
Sum = sum**2
Sum += value
Print(sum)
A) 6
B) 12
C) 8
D) 16
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
36
Assume x is equal to 5 and y is equal to 0. Which comparison operation returns True?
A) x == y or y
B) y < 5 and y
C) (x > y) and x
D) x > 0 and None
A) x == y or y
B) y < 5 and y
C) (x > y) and x
D) x > 0 and None
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
37
What is the output of the following code? sum = 0
Value = 3
While value <= 5:
Sum += value
Value += 1
Print(sum)
A) 15
B) 10
C) 12
D) 18
Value = 3
While value <= 5:
Sum += value
Value += 1
Print(sum)
A) 15
B) 10
C) 12
D) 18
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
38
What is the name of the function that contains the starting point of program execution?
A) start
B) main
C) begin
D) enter
A) start
B) main
C) begin
D) enter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
39
What is the output of the following code?
Sum = 0
For value in range(1,4):
Sum += value
Print(sum)
A) 5
B) 10
C) 4
D) 6
Sum = 0
For value in range(1,4):
Sum += value
Print(sum)
A) 5
B) 10
C) 4
D) 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which of the following is true about Python keywords?
A) they can begin with a number, letter, or hyphen
B) they are case sensitive
C) they are written in uppercase
D) they can be a maximum of 6 characters long
A) they can begin with a number, letter, or hyphen
B) they are case sensitive
C) they are written in uppercase
D) they can be a maximum of 6 characters long
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which of the following statements creates a tuple containing four items?
A) t = [ 1: 2: 3: 4 ]
B) t = {1, 2, 3, 4}
C) t =t = < 1; 2; 3; 4 >
D) t = (1, 2, 3, 4)
A) t = [ 1: 2: 3: 4 ]
B) t = {1, 2, 3, 4}
C) t =t = < 1; 2; 3; 4 >
D) t = (1, 2, 3, 4)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
42
What is the value of string1 after the following statement is executed?
String1 = "hello"[ :3 ] + "python"[ 0 ]
A) lpython
B) llo
C) help
D) lop
String1 = "hello"[ :3 ] + "python"[ 0 ]
A) lpython
B) llo
C) help
D) lop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
43
Select the answer that should be used to replace the missing code in the following statements. myList = list()
FileObj = open("myfile.dat", "rb")
While True:
Try:
Item = pickle.load(fileObj)
MyList.append(item)
< missing code >
FileObj.close()
Break
Print(myList)
A) if EOF:
B) elif Error:
C) except EOFError:
D) else while TRUE:
FileObj = open("myfile.dat", "rb")
While True:
Try:
Item = pickle.load(fileObj)
MyList.append(item)
< missing code >
FileObj.close()
Break
Print(myList)
A) if EOF:
B) elif Error:
C) except EOFError:
D) else while TRUE:
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
44
In a class definition, what type of method uses the values of the object's instance variables without changing them?
A) constructor
B) accessor
C) instance
D) mutator
A) constructor
B) accessor
C) instance
D) mutator
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
45
What is the last line of the output when the following code is executed?
X = 2
For exp in range (5):
Print ("%2d.0" % x**exp)
A) 8.0
B) 16
C) 32
D) 16.0
X = 2
For exp in range (5):
Print ("%2d.0" % x**exp)
A) 8.0
B) 16
C) 32
D) 16.0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
46
What is the value of z after the following code is run?
Y = 0
Z = 0
For x in range(5,8):
Z = max(x, y)
Y = y + x
A) 18
B) 11
C) 7
D) 13
Y = 0
Z = 0
For x in range(5,8):
Z = max(x, y)
Y = y + x
A) 18
B) 11
C) 7
D) 13
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
47
What are the values of variables x, y, and z after the following code is run?
Y = 0
Z = 0
For x in range(5,7):
If y > z:
Z, y = y, z
Y = y + x;
A) x == 7, y == 11, z == 6
B) x == 6, y == 6, z == 5
C) x = 6, y == 5, z == 6
D) x == 7, y == 12, z == 5
Y = 0
Z = 0
For x in range(5,7):
If y > z:
Z, y = y, z
Y = y + x;
A) x == 7, y == 11, z == 6
B) x == 6, y == 6, z == 5
C) x = 6, y == 5, z == 6
D) x == 7, y == 12, z == 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
48
How do you describe a function that calls itself?
A) self_calling function
B) iterative function
C) derivative function
D) recursive function
A) self_calling function
B) iterative function
C) derivative function
D) recursive function
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
49
What is the value of newList after the following code is executed?
NewList = [ "George", "John", "Thomas", "James" ]
NewList.pop()
NewList.append("Andrew")
A) [ "George", "John", "Thomas", "James", "Andrew" ]
B) [ "George", "John", "Thomas", "Andrew" ]
C) [ "Andrew", "John", "Thomas", "James" ]
D) [ "Andrew", "George", "John", "Thomas", "James" ]
NewList = [ "George", "John", "Thomas", "James" ]
NewList.pop()
NewList.append("Andrew")
A) [ "George", "John", "Thomas", "James", "Andrew" ]
B) [ "George", "John", "Thomas", "Andrew" ]
C) [ "Andrew", "John", "Thomas", "James" ]
D) [ "Andrew", "George", "John", "Thomas", "James" ]
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
50
What is the last line of output of the following code?
Pres = {1:"Washington", 16:"Lincoln", 35: "Kennedy", 40:"Reagan"}
For nth in pres:
Print("%2d:" % nth,pres[ nth ])
A) 35: Kennedy
B) 40: Reagan
C) 03: Kennedy
D) 04: Reagan
Pres = {1:"Washington", 16:"Lincoln", 35: "Kennedy", 40:"Reagan"}
For nth in pres:
Print("%2d:" % nth,pres[ nth ])
A) 35: Kennedy
B) 40: Reagan
C) 03: Kennedy
D) 04: Reagan
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck
51
Which of the following correctly defines a function named myFunc?
A) def myFunc():
B) func myfunc:
C) myfunc()#
D) int myFunc:
A) def myFunc():
B) func myfunc:
C) myfunc()#
D) int myFunc:
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 51 في هذه المجموعة.
فتح الحزمة
k this deck