Intro to Python 3 Programming

  1. In IDLE, how do you open a new file in which to type your code?




    B. File > New File
  2. In IDLE, what color do keywords appear in?




    A. Purple
  3. What file extension is used for Python files?




    D. py
  4. What is the name of a program that translates high-level instruction all at once, before any code is run?




    A. A compiler
  5. Which of the following is the Python command prompt?




    D. >>>
  6. In Python, a set of characters that are enclosed in double quotes (" ") are known as what?




    D. A literal string
  7. What would happen if you typed the following Python statement at the Python command prompt?

    print ("hello")




    D. You would see the word hello on the screen
  8. Which of the following statements regarding IDLE is correct?




    A. IDLE is a free development environment for Python
  9. Which of the following is a reserved keyword in Python?




    B. else
  10. In quote = "Hello" what is Hello?




    B. a string
  11. What function would you use to convert a text string such as "2.22" to a numeric value that can be used in a math operation?




    D. float ()
  12. How would you represent 2 to the 5th power in a math calculation?




    D. 2 ** 5
  13. What does the code "*" * 40 do?




    A. Displays 40 asterisks in a row
  14. Which of the following code segments will generate an error?




    B. phrase = ""Thank you""
  15. What is the result of the following line of code?

    print ("why" * 3)




    A. why why why
  16. Which of the following operators computes the value of 5 squared?




    B. **
  17. What is the name of the library file that contains a variety of mathematical functions and constraints?




    A. math
  18. What will the following code print?


    word = "abcdefg"
    print (word[3:5])




    C. de
  19. Which of these is a Boolean condition?




    C. true or false
  20. In an if statement, which comes first?




    C. The condition you are evaluating
  21. In an if statement, where is a colon placed?




    C. Between the condition and the statements to be performed if the condition is true
  22. How would you use a relational operator to describe a condition where age does not equal 0?




    B. age != 0
  23. In Unicode sort order, which of these letters comes after the letter w?




    C. None of these
  24. An if-then-else statement is an example of what?




    A. A two-way statement
  25. An elif statement combines what other two statements into a single operation?




    D. if and else
  26. Using the following variables:
    a = 1
    b = 2
    Which of the following statements will evaluate to false?

    A. if a == 1 and b == 1:
    B. if a == 1 or b == 1:
    C. if a == 2 or b == 2:
    D. if a == 1 or b == 2:
    A. if a == 1 and b == 1:
  27. Which of the following operators tests for inequality in Python?




    C. !=
  28. Which of the following statements about the syntax of the if structure is correct?




    D. Python allows you to have an if statement without an else clause
  29. What term describes when a programmer places one if statement in the true path of another if statement?




    B. Nested ifs
  30. Which of the following keyboards makes a multiway if statement in Python?




    D. elif
  31. What type of loop uses a variable to keep track of the number of times the loop body should execute?




    D. Counter controlled loop
  32. Which of the following calls to the range function will give me the even numbers from 10 to 20, including both 10 and 20?




    C. range (10, 21, 2)
  33. Which of the following key combinations will stop Python in the middle of running an infinite loop?




    D. CTRL + C
  34. Which of the following statements can be used inside a loop structure to skip the remaining lines of code in that iteration of the loop and start a new iteration?




    D. continue
  35. Which of the following compound conditions will evaluate to true even when the value in the choice variable is "N"?



    C. choice == "Y" or "y"
Author
jdavis123
ID
357140
Card Set
Intro to Python 3 Programming
Description
Updated