Python programming language

Description

Quiz on Python programming language, created by Sam Gue on 25/05/2014.
Sam Gue
Quiz by Sam Gue, updated more than 1 year ago
Sam Gue
Created by Sam Gue almost 10 years ago
37
1

Resource summary

Question 1

Question
Variables: How do you form a variable?
Answer
  • variable_name = ("variable_content")
  • variable_name = ["variable_content"]
  • variable_name = {"variable_content"}
  • variable_name = "variable_content"

Question 2

Question
If statements: What follows an if statement?
Answer
  • A colon :
  • An equals =
  • A semi-colon ;

Question 3

Question
If statements: what are the other statements?
Answer
  • Elseif and Else
  • Elif and Else

Question 4

Question
Loops: How do you form a while loop?
Answer
  • while 'X' then:
  • while 'X':

Question 5

Question
Loops: What will this 'for loop' do?: for i in range(5):
Answer
  • repeat the number five forever
  • repeat something five times
  • repeat five things, five times

Question 6

Question
String indexing: print(word[3]), what will happen?
Answer
  • it will print word three times
  • it will print the third letter in word
  • it will print the third item in the list: word
  • it will print the fourth letter in word

Question 7

Question
Lists: how do you add something to a list?
Answer
  • list_name.add(value)
  • list_name.input(value)
  • append(value).list_name
  • list_name.append(value)

Question 8

Question
Functions: How do you form a user defined function?
Answer
  • define function_name(): return X
  • def function_name(): return X

Question 9

Question
Text Files: How do you open and close a reading text file?
Answer
  • file_name.open("X.txt", "r")
  • file_name.open("X.txt", "r+")
  • file_name.open("X.txt", "w")
  • file_name.open("X.txt", "a")

Question 10

Question
Procedures: What does a procedure lack as opposed to a User Defined Function
Answer
  • return X
  • def procedure_name():
Show full summary Hide full summary

Similar

HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Historical Development of Computer Languages
Shannon Anderson-Rush
Useful String Methods
Shannon Anderson-Rush
Flvs foundations of programming dba 2
mariaha vassar
Python Quiz
karljmurphy
computer systems and programming quiz
Molly Batch
Think Python
tsilvo2001
C Programming
Miki Rana
Generations of Programming Languages
Balikkoftesi
Mapa Conceptual - Arreglos
ciroivan94