Q1.
BEG
What will be the output of the following program?
You have to predict the output yourself without running/executing the code.
print("Hello,", "કેમ છો?")- Hello,કેમ છો?
- ”Hello, કેમ છો?”
- Hello, કેમ છો?
- Hello, how are you?
Q2.
BEG
Write a program that asks the user to enter an integer number and then enter a second integer number. The program should tell the user what the result of adding and subtracting those two numbers is.
Expected Output:
Enter the first integer number: 6 // user input
Enter the second integer number: 4 // user input
6 + 4 = 10
6 - 4 = 2Q3.
What will be the output of the following programs?
You have to predict the output yourself without running/executing the code.
I.
BEG
x x = 5 print(x)II.
BEG
message = 'Hi' print(message) message = 'Bye' print(message)III.
BEG
a = 5 print(a) b = 2 + a print(a, b) a = 2 - b print(a, b)IV.
INT
a = 'k' b = 0 print(a * b) 42 = a print(a * b)V.
INT
a = 5 print(a * b) b = 'good' c = 'bye' print(b * c)
Q4.
BEG
Write a program that takes an integer number from user and then prints the doubled and tripled value of that number.
Expected Output:
Enter an integer: 4 // user input
Double of 4: 8
Triple of 4: 12Q5.
BEG
Based on how you should name a variable, indicate whether each variable name mentioned below is conventional (follows best practices), unconventional (compiler will accept but does not follow best practices), or invalid (will not compile), and why.
sum_applesVALUEmy variable nameTotalCustomersclassnumFruit3subjectmeters_of_pipe
Q6.
What will be the output of the following programs?
You have to predict the output yourself without running/executing the code.
I.
BEG
a = 23 n = 3 print(a * n) a = 'lalala lala ' print(a * n)II.
INT
a = 0 b = 42.0 print(a + b) b = 'k' print(a + b)III.
BEG
x = 42 y = 7 print(x / y) z = -y y = 2 print(z / y)IV.
BEG
a = 'chachi' b = "420" print(a + b)V.
BEG
print("5 * 2 + 3")
Q7.
BEG
Write a program that prints the statement: Once a computer scientist, Frederik Brooks said - "What one programmer can do it in 1 week, two programmers can do it in 2 weeks.".
Q8.
BEG
Write a program that prompts the user to input their name and marks of 3 subjects, then calculates and displays their percentage.
Expected Output:
Enter your name: Honey // user input
Enter the marks of subject1: 75 // user input
Enter the marks of subject2: 93 // user input
Enter the marks of subject3: 87 // user input
Honey, you have got 85.0%.Q9.
BEG
Write a program where the user is asked to enter their weight (in kg) and height (in meters). Print the value of BMI.
The formula for BMI is: BMI = weight / (height x height)
Expected Output:
Enter your weight (kg): 70 // user input
Enter your height (m): 1.75 // user input
Your BMI: 22.86Q10.
What will be the output of the following programs?
You have to predict the output yourself without running/executing the code.
I.
BEG
code = 777 print("James Bond " + str(code))II.
BEG
can_vote = True print("Can user vote?:", can_vote) print("Can user vote?:", str(can_vote)) print("Can user vote?:", int(can_vote))III.
BEG
age = '20' age = int(age) + 1 print(age)IV.
BEG
firstname = "magan" print(firstname) firstName = "gagan" print(firstName)
Q11.
INT
Consider the program given below:
weight = int(input("Enter your weight (in kg): "))
print("Your weight is:", weight)What will be the output of the program if the user enters the values given below as the input:
You have to predict the output yourself without running/executing the code.
- 78
- 65.35
- Fifty Seven