Questions

3 Marks Each

🎯

Test yourself on this topic

25 questions · timed · auto-graded

Question 53 Marks
WAP to input two numbers and find their LCM and HCF.
Answer
Program to input two numbers and find their LCM and HCF.'
View full question & answer
Question 63 Marks
 WAP to input 10 numbers and then display their sum and average. Also display the largest and the smallest of the numbers entered.
View full question & answer
Question 83 Marks
WAP to input a number. If the number is negative, then again input the number. Keep on doing so until the user enters a positive number.
Answer
"'Script to input a number. If the number is negative, then again input the number. Keep on doing so until the user enters a positive number."'
View full question & answer
Question 93 Marks
Write a menu driven program to calculate the total surface area and volume of a cube, cuboid, or sphere depending upon user's choice. The program should continue until the user selects the option to exit the program.
View full question & answer
Question 113 Marks
 Write a python script to read the numbers from the user until user presses zero and print sum , average and maximum number entered by the user.
View full question & answer
Question 123 Marks
Write a python script to read a number from the user and print the Fibonacci series up to that number.
Answer
n=int(input("Enter Number:"))
a,b=0,1
print(a,end=" ")
for i in range(2,n+1):
print(b,end=" ")
a,b=b,a+b
View full question & answer
Question 133 Marks
Write script to find the sum of first n terms of the following series:
$1+ x +\frac{x^2}{2 !}+\frac{x^3}{3 !}+\ldots$
where n and x have to be input from the user.
Answer
Script:
"'Script to find the sum of first n terms of the following series:
1 + x + x**2/2! + x**3/3! + . .
where n and x have to be input from the user."'
n=eval(input("How many terms? "))
n=abs(int(n))
x=eval(input("Enter the value of x: "))
sum=1
factorial=1;
for i in range (1,n):
factorial*=i
sum += pow(x,i)/factorial
print("Sum of first",n,"terms of the series =",sum)
View full question & answer
Question 143 Marks
Write script to find the sum of first n terms of the following series:
$1+x+\frac{x^2}{2}+\frac{x^3}{3}+\ldots$
where n and x have to be input from the user.
Answer
Script:
"'#Script to find the sum of first n terms of the following series:
1 + x + x**2/2 + x**3/3 + . .
where n and x have to be input from the user."'
n=eval(input("How many terms? "))
n=abs(int(n))
x=eval(input("Enter the value of x: "))
sum=1
for i in range (1,n):
sum += pow(x,i)/i
print("Sum of first",n,"terms of the series =",sum)
View full question & answer
Question 153 Marks
Write script to find the sum of first n terms of the following series:
$x+x^2+x^3+\ldots$
where n and x have to be input from the user.
View full question & answer
Question 163 Marks
Write script to find the sum of first n terms of the following series:
$x+x^2+x^3+\ldots$
where n and x have to be input from the user.
Answer
Script:
"'To find the sum of first n terms of the following series:
x + x**2 + x**3 + . .
where n and x have to be input from the user."'

n=eval(input("How many terms? ")) n=abs(int(n))
x=eval(input("Enter the value of x: "))
sum=0
for i in range (1,n+1):
sum += pow(x,i)
print("Sum of first",n,"terms of the series =",sum)
View full question & answer
Question 183 Marks
Write a menu driven program to calculate the total surface area and volume of a cube, cuboid, or sphere depending upon user's choice. The program should continue until the user selects the option to exit the program.
Script:
View full question & answer
Question 193 Marks
Based on the following python code, find out the expected correct output(s) from the options (i) to (iv)
tup=("Red","Blue","Green","Yellow")
for i in range(3):
print(tup[random.randrange(1,4,2)],end="#")
(i) Blue#Blue#Yellow#
(ii) Red#Green#Green#
(iii) Blue#Yellow#Green# (iv) Blue#Green#Yellow#
Answer
(i)
View full question & answer
Question 203 Marks
Based on the following python code, find out the expected correct output(s) from the options (i) to (iv)
import random
lst=["Red","Blue","Green","Yellow"]
for i in range(5,2,-1):
print(lst[random.randint(1,2)],end="%")
(i) Blue%Green%Green%
(ii) Blue%Red%Green%
(iii) Blue%Green%Yellow%
(iv) Blue%Blue%Red%
Answer
(i)
View full question & answer
Question 213 Marks
Based on the following python code, find out the expected correct output(s) from the options (i) to (iv)
import random
for i in range(5,2,-1):
print(random.randint(1,3)+i,end="*")
(i) 7*6*4 (ii) 7*6*6
(iii) 6*7*9* (iv) 4*7*6*
Answer
 (i)
View full question & answer
Question 223 Marks
What possible outputs(s) are expected to be displayed on screen at the time of execution of the program from the following code? Also specify the maximum values that can be assigned to each of the variables BEGIN and LAST.
Answer
 (ii)
View full question & answer
Question 243 Marks
Write script to input 10 numbers and then display the smallest number entered. If the smallest number is an integer, then find the sum of its digits, otherwise display the message "smallest number is not an integer".
View full question & answer
3 Marks Each - Computer Science STD 12 Humanities Questions - Vidyadip