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

Exam PCAP All Questions

View all questions & answers for the PCAP exam

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 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
DKM
Highly Voted 3 years 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 10 months 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
2 years, 3 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, 6 months ago
A is correct =a. s.write ("Hello\n")
upvoted 1 times
...
macxsz
2 years, 6 months 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 ...