Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam PCAP topic 1 question 36 discussion

Actual exam question from Python Institute's PCAP
Question #: 36
Topic #: 1
[All PCAP Questions]

There is a stream named s open for writing. What option will you select to write a line to the stream?

  • A. s. write (ג€Hello\nג€)
  • B. write (s, ג€Helloג€)
  • C. s.writeln (ג€Helloג€)
  • D. s. writeline (ג€Helloג€)
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
Reference:
https://en.wikibooks.org/wiki/Python_Programming/Input_and_Output

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
DKM
Highly Voted 2 years, 6 months ago
There is a stream named s open for writing. What option would you select to write a line to the stream? a. s.write ("Hello\n") b. write (s, "Hello") c. s.writeIn ("Hello") d. s.writeline ("Hello")
upvoted 9 times
...
seaverick
Most Recent 3 months, 2 weeks ago
Selected Answer: A
s=open("file.txt","w") s.write ("Hello\n") #write (s, "Hello")#NameError: name 'write' is not defined #s.writeIn ("Hello")#AttributeError: '_io.TextIOWrapper' object has no attribute 'writeIn' #s.writeline ("Hello")#AttributeError: '_io.TextIOWrapper' object has no attribute 'writeline' Ans is A
upvoted 1 times
...
NTBLB
1 year, 9 months ago
When we create a class and initiate a constructor....any defined variable inside this constructor will be an unique instance of any newly created object. Class A: def __init__(self, number): self.number = number return self.number # when we give A() an argument...such argument will be the instance created for the object b b = A(2) # when we give A() an argument...such argument will be the instance created for the object c c = A(3) # instance of object b is different from instance of object c Answer is D
upvoted 1 times
...
666_m
2 years ago
A is correct =a. s.write ("Hello\n")
upvoted 1 times
...
macxsz
2 years ago
Selected Answer: A
answer: A. s.write("Hello\n")
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...