V.Vidhya Logo

V.Vidhya

Variables, Data Types & User I/O


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,", "કેમ છો?")
  1. Hello,કેમ છો?
  2. ”Hello, કેમ છો?”
  3. Hello, કેમ છો?
  4. 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 = 2

Q3.

What will be the output of the following programs?

You have to predict the output yourself without running/executing the code.


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: 12

Q5.

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.

  1. sum
  2. _apples
  3. VALUE
  4. my variable name
  5. TotalCustomers
  6. class
  7. numFruit
  8. 3subject
  9. meters_of_pipe

Q6.

What will be the output of the following programs?

You have to predict the output yourself without running/executing the code.


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.86

Q10.

What will be the output of the following programs?

You have to predict the output yourself without running/executing the code.


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.

  1. 78
  2. 65.35
  3. Fifty Seven

Next Post
Operators