Q. In an exam, following code snippets were provided:
hello('Hello is same as')
Mark the correct print outputs.
Q. A developer wrote the following code snippet:
print ("This is the main function")
print ("Lets call print from main")
The output desired was -
This is the main function
Lets call print from main
But he was not getting it. Which of the following options,should be applied?
Q. Below are given a few scenarios.
He gave them the following example :
Mark the correct answer.
Q. In an interview,a fresher was given the following code snippet:
Choose the correct answer.
Q. Below are mentioned a few key points:
- Mainly used for data analysis,graphical models , statistics etc.
- Most of its code is slow.
- Ease of preparation,of new models,like matrix computation etc.
- It gets integrated with applications efficiently.
Mark,which language has a dominance,in the above points (R or Python)
Q. A developer was practicing some code snippets. He came across the following:
from nltk.stem import PorterStemmer
for word in examplewords:
Mark the correct output of the same.
Q. In an exam,following code snippets, were provided:
rhyme = """twinkle
result2 = re.findall(r"^\w", rhyme, re.MULTILINE)
match=re.search('^\w*nts','All tennis tournaments?')
Mark the appropriate syntax, to do the above.(NOTE: np is the numpy object).
Q. In an exam,developers were given a few descriptions,about Python compilers and interpreters:
- With this compiler, Python scripts can interact with .NET objects.
- We can run the python code,on any machine,that has JVM,because of this compiler.We can also extend Java classes.
- With this framework,one can develop, client-side web applications,that can run in a browser.
Mention the names that map to them. Mark the appropriate answer.
Q. Below are given a few statements,about the Python main function:
- Python sets,special variable(__name__) to have value (__main__), when source file is run as a main program.
- Python modules can be used as standalone programs,because of "if__name__== "__main__". But they cannot be treated as reusable modules.
- When the main function is executed, interpreter will read the "if" statement,and,check if __name__ is equal to __main__.
- It is important to take care of indentation,after declaring the main function,else,one can get an Indentation error.
Mark them as Valid(V) or Invalid(In).
Q. A lead was explaining to his team,theory about Python memory management. Below are a few mentioned points:
- A private heap space manages the memory in Python.It is the place where all objects and data structures,are located.
- Python memory manager,allocates space,for python objects on the heap
- Python is unique,as its interpreter allows a programmer some access to the private heap.
- There is a inbuilt garbage collector,that recycles unused memory,and,makes it available to the heap.
Mark which of them are True or False.