Pructor Python Quiz 7 by anupmaurya June 12, 2021 written by anupmaurya June 12, 2021 281 April 19, 2024 Welcome to your Pructor Python Quiz 5 1. What does the following Python3 code do? (using python 3.X version): n = int(input('Enter a number?'))i = 1while i <= n: i = i+1 print (i)Deselect Answer a) Print all integers from 1 to n b) Print all integers from 1 to n-1 c) Print all integers from 2 to n d) Print all integers from 2 to n+1 1 out of 5 2. What will the output of the following Python3 program (using python 3.X version)? n = 13sum = 0while (n> 1): n = n//2 sum = sum + nprint(sum)Deselect Answer a) 2 b) 10 c) 9 d) Error 2 out of 5 3. What will the output of the following Python3 program? If the program has error, select the option ERROR (using python 3.X version): n,p = 9,1while (n >= 1): n,p = n//2,n*p print(int(p))Deselect Answer a) 8 b) 102 c) 9 36 72 72 d) Error 3 out of 5 4. The following code should print all positive even numbers less than or equal to N. N is taken as input from the user. What should replace the X for the code to work correctly?(using python 3.X version): int(input('Enter N:'))i = 1while ( i < N ) : if ( X ): print(i) i = i + 1Deselect Answer a) i//2 == 0 b) i%2 != 0 c) i//2 != 0 d) i%2 == 0 4 out of 5 5. The following code should print all positive odd numbers less than or equal to N. N is taken as input from the user. What should replace the X for the code to work correctly? (using python 3.X version): N = int(input('Enter N:'))i = 1while ( i < N ) : print(i) XDeselect Answer a) i = i + 2 b) i=i+3 5 out of 5 Name Email 0 comment 0 FacebookTwitterPinterestEmail anupmaurya "Hi there, My name is Anup Maurya. I have a passion for programming and previously worked at TCS, one of the best global IT services and consulting companies, as a System Administrator. I also enjoy graphic design. It's a pleasure to have you here." previous post Pructor Python Quiz 6 next post Pructor Python Quiz 1 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment.