Q.1
What is it called where child object gets killed if parent object is killed?
  • Aggregation
  • Composition
  • Encapsulation
  • Association
Q.2
Which of the following is associated with objects?
  • State
  • Behaviour
  • Identity
  • All the above
Q.3
Choose the behaviour of Class: time
  • getHour
  • Print Time
  • Second
  • Both A & B
Q.4
Which Feature of OOP illustrated the code reusability?
  • Polymorphism
  • Abstraction
  • Encapsulation
  • Inheritance
Q.5
Pure OOP can be implemented without using class in a program. (True or False)
  • True
  • False
Q.6
Which of the following best defines a class?
  • Parent of an object
  • Instance of an object
  • Blueprint of an object
  • Scope of an object
Q.7
How do you rename a file?
  • fp.name = ‘new_name.txt’
  • os.rename(existing_name, new_name)
  • os.rename(fp, new_name)
  • os.set_name(existing_name, new_name)
Q.8
What is the use of tell() method in python?
  • tells you the current position within the file
  • tells you the end position within the file
  • tells you the file is opened or not
  • none of the mentioned
Q.9
The readlines() method returns ____________
  • str
  • a list of lines
  • a list of single characters
  • a list of integers
Q.10
If a function doesn’t have a return statement, which of the following does the function return?
  • int
  • null
  • None
  • Exception
Q.11
What is the type of each element in sys.argv?
  • set
  • list
  • tuple
  • string
Q.12
How many keyword arguments can be passed to a function in a single function call?
  • zero
  • one
  • zero or more
  • one or more
Q.13
What is the value stored in sys.argv[0]?
  • null
  • you cannot access it
  • the program’s name
  • the first argument
Q.14
Which of the following statements is false about recursion?
  • Every recursive function must have a base case
  • Infinite recursion can occur if the base case isn’t properly mentioned
  • A recursive function makes the code easier to understand
  • Every recursive function must have a return value
Q.15
To read two characters from a file object infile, we use ____________
  • infile.read(2)
  • infile.read()
  • infile.readline()
  • infile.readlines()
Q.16
To read the next line of the file from a file object infile, we use ____________
  • infile.read(2)
  • infile.read()
  • infile.readline()
  • infile.readlines()
Q.17
What is the type of sys.argv?
  • string
  • array
  • list
  • tuple
Q.18
Where is function defined?
  • Module
  • Class
  • Another function
  • All of the mentioned
Q.19
Which are the advantages of functions in python?
  • Reducing duplication of code
  • Decomposing complex problems into simpler pieces
  • Improving clarity of the code
  • All of the mentioned
Q.20
Java uses both compiler and interpreter
  • true
  • false
0 h : 0 m : 1 s