Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password

Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.

Question

All members in a Python class are public by default.
Group of answer choices

True

False
click to flip
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't know

Question

An instance attribute can be accessed using dot notation.
True
False
Remaining cards (61)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Python F5-6

QuestionAnswer
All members in a Python class are public by default. Group of answer choices True False TRUE
An instance attribute can be accessed using dot notation. True False True
All members in a Python class are protected by default. Group of answer choices True False False
The except block, if specified, will be executed regardless if the try block raises an error or not. Group of answer choices True False False
You can not define as many exception blocks as you want. Group of answer choices True False False
The try block lets you execute code, regardless of the result of the try- and except blocks. Group of answer choices True False False
Which of the following is not an exception handling keyword in Python? Group of answer choices try except accept finally accept
What will be the output? class change: def __ init __ (self, x, y, z): self.a = x + y + z x = change(1,2,3) y = getattr(x, 'a') setattr(x, 'a', y+1) print (x.a) 7
Python is an object oriented programming language. true or false True
Class definitions cannot be empty. Group of answer choices True False False
A quadrilateral class having four sides as instance variables and a perimeter() method is defined. Group of answer choices True False True
The rectangle() method is overridden to implement the formula for the area of the square as the square of its sides true or false False
What relationship is best suited for Employee and Person? Group of answer choices inheritance None of the mentioned association composition inheritance
What will be the output? class A(): def disp(self): print("A disp()") class B(A): pass obj = B() obj.disp() A disp()
An exception is ____________. Group of answer choices an object a standard module a special function a module an object
You can use the else keyword to define a block of code to be executed if no errors were raised. Group of answer choices True False True
A single underscore _ prefixed to a variable makes it private. True or false False
Use the __init__() function to assign values to object properties, or other operations that are necessary to do when the object is being created. true or false True
If you for some reason have a class definition with no content, put in the pass statement to avoid getting an error. true or false True
Self parameter is used to access variables that belong to the class. Group of answer choices True False True
Which of the following is not a class method? Group of answer choices Static Bounded Unbounded Non-static Non-static
Objects can also contain methods. Group of answer choices True False True
Instance attributes and methods defined in the child class will be inherited by the object of the parent class. Group of answer choices True False False
To throw (or raise) an exception, use the raise keyword. Group of answer choices True False True
Not a standard exception in Python Group of answer choices ValueError NameError IOError AssignmentError AssignmentError
A class in Python can be defined using the class keyword. Group of answer choices True False True
Protected members of a class are accessible from within the class and are also available to its sub-classes. Group of answer choices True False True
What are the methods which begin and end with two underscore characters called? Group of answer choices Additional methods Special methods User-defined methods False In-built methods Special methods
The object of the same class is required to invoke a protected method. Group of answer choices True False False
The inherited class contains a new definition of a method (with the same name and the signature already present in the base class). True or false True
To throw (or raise) an exception, use the delete keyword. True or false False
Choose to throw an exception if a condition occurs. Group of answer choices True False True
Which of the following is not a standard exception in Python? Group of answer choices ValueError AssignmentError IOError NameError AssignmentError
When is the finally block executed? Group of answer choices only if some condition that has been specified is satisfied when there is no exception always when there is an exception always
What will be the output? class test: def _init __ (self,a="Hello World"): self.a=a def display(self): print (self.a) obj=test() obj.display() “Hello World” is displayed
The arrangement of private instance variables and public methods ensures the principle of inheritance. Group of answer choices True False False
Class in objects are functions that belong to the object. Group of answer choices True False False
What relationship is best suited for House and Door? Group of answer choices association inheritance composition None of the mentioned composition
You can define as many exception blocks as you want. Group of answer choices True False True
Instance attributes and methods defined in the parent class will be inherited by the object of the child class. Group of answer choices True False True
The object of a new class will have access to both methods, but the one from its own class will have precedence when invoked. This is called method overriding. Group of answer choices True False True
Methods of the child class are available for use in the inherited class. Group of answer choices True False False
Which of the following statements is true? -All raised standard exceptions must be handled in Python -If any exception is thrown in try block, else block is executed - The standard exceptions are automatically imported into Python programs The standard exceptions are automatically imported into Python programs
A function can return data as a result. Group of answer choices True False True
What is a recursive function? Group of answer choices A function which calls itself. A function that calls other function. The size of object. None A function which calls itself.
What statement to let a function return a value? Group of answer choices none print delete return return
Which of the following function headers is correct? Group of answer choices def fun(a, b, c = 3, d) def fun(a = 2, b, c = 3) def fun(a = 2, b = 3, c) def fun(a, b = 2, c = 3) def fun(a, b = 2, c = 3)
Which of the following is the use of id() function in python? Group of answer choices All of the mentioned None of the mentioned Id returns the identity of the object Every object doesn’t have a unique id Id returns the identity of the object
Lambda function has the benefit of meaning that you can loop through data to reach a result. Group of answer choices True False False
A function that call itself. Group of answer choices predefined recursive loop redundant recursive
Function has the benefit of meaning that you can loop through data to reach a result. Group of answer choices True False True
What will be the output of the following Python code? def find(a, **b): print(type(b)) find(‘letters’, A=’1’,B=’2’) Group of answer choices Tuple String An exception is thrown Dictionary Dictionary
Which of the following is the use of id() function in python? Group of answer choices Id returns the identity of the object None of the mentioned All of the mentioned Every object doesn’t have a unique id Id returns the identity of the object
To let a function return a value, use the print statement. Group of answer choices True False False
Select which is true for Python function. Group of answer choices A function can take an unlimited number of arguments. A function cannot return data as a result A Python function can return only a single value A function can take an unlimited number of arguments.
Which keyword is use for function? Group of answer choices define function fun def def
A lambda function can take any number of arguments, but can only have one expression. Group of answer choices True False True
What happens if the base condition isn’t defined in recursive programs? Group of answer choices Program gets into an infinite loop An exception is thrown Program runs once Pr program gets into an infinite loop
A lambda function can take any number of arguments and have two expression. Group of answer choices True False False
Which of these is not true about recursion? Group of answer choices Sequence generation is easier than a nested iteration Recursive calls take up less memory Making the code look clean A complex task can be broken into sub-problems Recursive calls take up less memory
What will be the output of the following Python code? def change(one, *two): print(type(two)) change(1,2,3,4) Group of answer choices An exception is thrown Integer Tuple Dictionary Tuple
Python supports the creation of anonymous functions at runtime, using a construct called. Group of answer choices lambda none of the mentioned anonymous pi lambda
Created by: Easy Kwatro
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards