V.Vidhya Logo

V.Vidhya

Structure


Q1.

A small bookstore wants to keep a simple record of a book.

Write a program that stores the details of a book - its title, author name, price and category (a predefined set of categories such as Fiction, Non-Fiction, Science, History etc.). Once the book details are stored, display them on the screen.

Expected Output:

--- Book Details ---

Title     : Awareness
Author    : JAnthony De Mello
Price     : 599.00  
Category  : Spirituality

Q2.

What will be the output of the following programs?

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


Q3.

What will be the output of the following programs?

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


Q4.

You’re building a small calculator that helps users multiply two fractions.

The program should ask the user to enter two fractions one by one (numerator and denominator separately for each). Once both fractions are entered, the program should multiply them and display the result in the form numerator/denominator.

Expected Output:

Enter a value for the numerator: 1
Enter a value for the denominator: 2

Enter a value for the numerator: 3
Enter a value for the denominator: 4

Your fractions multiplied together: 3/8

Q5.

What will be the output of the following programs?

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


Q6.

You run a website that earns money through advertisements. Create a small tool that helps you calculate your daily earnings from ads.

The program should ask for:

Once the inputs are taken, the program should display all the entered values clearly. It should also show the total money earned that day by multiplying all three values.

Expected Output:

Enter the number of ads watched: 1000
Enter the percentage of users who clicked on an ad: 12.5
Enter the average earnings per clicked ad: 0.75

Ads watched: 1000
Click-through rate: 12.5%
Earnings per clicked ad: 0.75

Total earnings today: 93.75

Prev Post
Enums
Next Post
Classes, Member Functions & Access Specifiers (OOP)