+ 2

answer plz

How many characters would be in each line printed by this code, if one character is one byte? file = open("filename.txt", "r") for i in range(21): print(file.read(4)) file.close()

29th Apr 2020, 2:59 PM
Arpita Chakraborty
Arpita Chakraborty - avatar
27 Respostas
+ 11
the correct answer is 2, 4/2= 2
9th Jun 2021, 11:31 PM
Jorge Ponton
Jorge Ponton - avatar
+ 9
Explanation This code will loop for 21 lines that are from 0 to 20. On each line, it will read 4 bytes ( i.e. if each character is of 1 byte then it will read 4 characters from each of the 21 lines). And according to the question, the answer is 4, as it is asking the number of characters that is going to be printed in each line NOT the total number of characters.
2nd Feb 2022, 2:11 PM
MRIDUL CHANDRAWANSHI
+ 5
the answer is 4
18th May 2020, 9:52 AM
KANTAMNENI JAYADEEPTHI
KANTAMNENI JAYADEEPTHI - avatar
+ 2
answer is 2 . one character is of two bytes then read argument have (4) then 4/2 = 2
23rd Apr 2021, 6:59 AM
Aqsam Zaheer
Aqsam Zaheer - avatar
+ 1
4
24th May 2020, 10:56 AM
Jaouad DARIR
+ 1
The answer is 4
1st Jul 2020, 6:29 AM
vaishnavi baheti
vaishnavi baheti - avatar
+ 1
answer is 4
15th Jan 2021, 5:29 PM
Syed Fahad Ahmed
Syed Fahad Ahmed - avatar
+ 1
4
4th Feb 2021, 7:05 AM
br0k3n
br0k3n - avatar
+ 1
2
16th Aug 2021, 11:06 AM
Sahana ca
Sahana ca - avatar
+ 1
Answer Is 4.
10th Oct 2021, 6:40 PM
Syed Fahad Ahmed
Syed Fahad Ahmed - avatar
+ 1
Please the answer is 4 not 2
4th Sep 2022, 11:27 PM
Opanuga Stephen
Opanuga Stephen - avatar
+ 1
the answer is 2
16th Nov 2022, 10:55 AM
Guy Martial KEYOU
0
the answer is 2
28th Apr 2021, 5:07 PM
19EPCI005- Anala Mukkonil Alex
19EPCI005- Anala Mukkonil Alex - avatar
0
the answer is 2
13th Sep 2021, 5:49 PM
guenaizi abdelkader
guenaizi abdelkader - avatar
0
Answer is "2"
1st Oct 2021, 4:32 PM
Adi Vaidya
0
How many characters would be in each line printed by this code, if one character is one byte? file = open("filename.txt", "r") for i in range(21): print(file.read(4)) file.close() 4
22nd Sep 2022, 3:51 PM
ABDUL WAHAB
0
ur mum
24th Apr 2023, 4:36 PM
Levi Gerding
Levi Gerding - avatar
0
Why do I get an error when I ran this code?
26th Apr 2023, 8:26 PM
Karume
0
The answer is 2
27th Apr 2023, 11:04 AM
Kalyani Boyanapalli
Kalyani Boyanapalli - avatar
0
Thank you...
27th Apr 2023, 6:20 PM
Karume