| Snaprecruit.com

| Snaprecruit.com

Interview question based on skill :

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. Identify the type of error in the codes shown below. Print(“Good Morning”) print(“Good night)

Correct Answer is : Semantic, Syntax

2. Which of the following statements is true?

Correct Answer is : The standard exceptions are automatically imported into Python programs

3. Which of the following is not a standard exception in Python?

Correct Answer is : AssignmentError

4. Syntax errors are also known as parsing errors. Is this statement true or false?

Correct Answer is : TRUE

5. An exception is:

Correct Answer is : an object

6. _______________________ exceptions are raised as a result of an error in opening a particular file.

Correct Answer is : IOError

7. Which of the following blocks will be executed whether an exception is thrown or not?

Correct Answer is : finally

8. To open a file c:\scores.txt for reading, we use

Correct Answer is : infile = open(“c:\\scores.txt”, “r”)

9. To open a file c:\scores.txt for reading, we use

Correct Answer is : infile = open(“c:\\scores.txt”, “r”)

10. To open a file c:\scores.txt for writing, we use

Correct Answer is : outfile = open(“c:\\scores.txt”, “w”)

11. To open a file c:\scores.txt for writing, we use

Correct Answer is : outfile = open(“c:\\scores.txt”, “w”)

12. To open a file c:\scores.txt for appending data, we use

Correct Answer is : outfile = open(“c:\\scores.txt”, “a”)

13. To open a file c:\scores.txt for appending data, we use

Correct Answer is : outfile = open(“c:\\scores.txt”, “a”)

14. Which of the following statements are true?

Correct Answer is : All of the mentioned

15. Which of the following statements are true?

Correct Answer is : All of the mentioned

16. To read two characters from a file object infile, we use

Correct Answer is : infile.read(2)

17. To read two characters from a file object infile, we use

Correct Answer is : infile.read(2)

18. To read the entire remaining contents of the file as a string from a file object infile, we use

Correct Answer is : infile.read()

19. To read the entire remaining contents of the file as a string from a file object infile, we use

Correct Answer is : infile.read()

20. What is the output? f = Nonefor i in range (5): with open("data.txt", "w") as f: if i > 2: breakprint(f.closed)

Correct Answer is : TRUE