On this pageExamQuestion 1โWhat notions are defined inside the smart contract?The type definition of the storageThe balance of the contractThe initial value of the storageThe value of the entrypoint and its related parametersThe type definition of the entrypointThe code of the smart contractQuestion 2โWhat is returned by the execution of a smart contract?The current storage state when invoking the smart contractThe modified storage state after the invocation of the smart contractThe entrypoint that has been called (and its related parameters)The list of emitted operations produced by the execution of the smart contractThe balance of the contractThe size of the storageThe code of the smart contractThe list of users allowed to call the smart contractQuestion 3โWhat can you do with the SmartPy online editor?Write, test and run your codeVisualize the generated Michelson code and storage. View the results of the tests as an HTML document. Access a panel of several smart contract templates.Question 4โWhat is a SmartPy smart contract?It is a class of method called `main` taking as input a storage and parameters, returning a list of operations and a modified storage.It is a class definition that inherits from `sp.Contract`. A SmartPy contract consists in a state with one or several entry points.Question 5โWhat is the correct way to add an integer x initialized to 0 to the storage?@sp.storagedef __init__(self): self.init(x = 0)Copy@sp.storagedef storage(self): self.x = 0Copydef __init__(self): self.init(x = 0)Copydef __init__(self): self.x = 0Copydef __storage__(self): self.init(x = 0)CopyQuestion 6โWhat is true about the definition of entrypoints with SmartPy?Entrypoints are methods of a contract class that can be called from the outside.Entrypoints are class definition that inherits from `sp.Contract`.Entrypoints return values in Michelson.Entrypoints need to be marked with the `@sp.entry_point` decorator.Question 7โWhat is true about tests and scenarios with SmartPy?A new test is a method marked with the `sp.add_test` decorator.A new scenario is instantiated by `sp.test_scenario`.Scenarios describe a sequence of actions: originating contracts, computing expressions, calling entry points, etc.SmartPy provides the possibility to generate test accounts with `sp.test_account(seed)` which contain the following fields: `account.address`, `account.public_key_hash`, `account.public_key`, and `account.secret_key`.Question 8โWhat is true about types with SmartPy?SmartPy expressions do not have a type.Just like in Python, most of the time, there is no need to specify the type of the object in SmartPy.SmartPy uses type inference to determine each expression's type.SmartPy types are all in the form `sp.T<TypeName>`.Question 9 and 10โFor the next two questions let's consider the following piece of code:class Hello(sp.Contract): def __init__(self): self.init(x = 0) @sp.entry_point def set_x(newX): # Todo: set x from the storage to newXCopyWhat is the correct way to set x from the storage to newX.@sp.entry_pointdef set_x(newX): self.x = newXCopy@sp.entry_pointdef set_x(newX): self.data.x = newXCopy@sp.entry_pointdef set_x(newX): x = newXCopy@sp.entry_pointdef set_x(newX): newX = self.data.xCopyWhat is the correct way to modify the code to check that newX is greater than 0 for the entrypoint set_x? (If not, we want the entrypoint invocation to fail and return an error message.)@sp.entry_pointdef set_x(newX): verify(newX >= 0, message="x must be a positive number") self.data.x = newXCopy@sp.entry_pointdef set_x(newX): sp.if(newX >= 0, message="x must be a positive number"): self.data.x = newXCopy@sp.entry_pointdef set_x(newX): sp.verify(newX >= 0, message="x must be a positive number") self.data.x = newXCopy@sp.entry_pointdef set_x(newX): sp.check(newX >= 0, message="x must be a positive number") self.data.x = newXCopy