Podcast
Questions and Answers
What is the purpose of the program that prints 'Hello World'?
What is the purpose of the program that prints 'Hello World'?
What is the output of the program that calculates the ASCII value of a character when 'c' is entered?
What is the output of the program that calculates the ASCII value of a character when 'c' is entered?
In the program that calculates the sum and average of two numbers, which line correctly calculates the average?
In the program that calculates the sum and average of two numbers, which line correctly calculates the average?
What is missing from the program that calculates total and percentage of marks for 5 subjects?
What is missing from the program that calculates total and percentage of marks for 5 subjects?
Signup and view all the answers
What is the data type of the variable 'avg' used in the program that calculates sum and average?
What is the data type of the variable 'avg' used in the program that calculates sum and average?
Signup and view all the answers
What is the purpose of the statement 'percent = total/5;' in the source code?
What is the purpose of the statement 'percent = total/5;' in the source code?
Signup and view all the answers
What will be the output for the entered number 0 in the even/odd program?
What will be the output for the entered number 0 in the even/odd program?
Signup and view all the answers
Which part of the program checks whether the number is prime?
Which part of the program checks whether the number is prime?
Signup and view all the answers
What condition would lead to a 'not prime' classification for the number 9 in the prime-checking program?
What condition would lead to a 'not prime' classification for the number 9 in the prime-checking program?
Signup and view all the answers
What bonus does the program assign if sales are below 10,000?
What bonus does the program assign if sales are below 10,000?
Signup and view all the answers
What will be the value of DA when the basic salary is 1000 and the sales amount is greater than 10,000?
What will be the value of DA when the basic salary is 1000 and the sales amount is greater than 10,000?
Signup and view all the answers
What is the primary use of a conditional statement in programming?
What is the primary use of a conditional statement in programming?
Signup and view all the answers
Which function is used to read input from the user in the given programs?
Which function is used to read input from the user in the given programs?
Signup and view all the answers
What will be the total salary if the sales amount entered is 9,000?
What will be the total salary if the sales amount entered is 9,000?
Signup and view all the answers
In the second program, what will happen if the input numbers are 5, 5, and 5?
In the second program, what will happen if the input numbers are 5, 5, and 5?
Signup and view all the answers
What is the output of the program when the input number is -10?
What is the output of the program when the input number is -10?
Signup and view all the answers
Which statement about the total salary calculation is incorrect?
Which statement about the total salary calculation is incorrect?
Signup and view all the answers
What will be printed when the input is 0 in the third program?
What will be printed when the input is 0 in the third program?
Signup and view all the answers
How will the largest number be determined in the second program?
How will the largest number be determined in the second program?
Signup and view all the answers
If the sales amount entered is 12,000, how much bonus will be added to the total salary?
If the sales amount entered is 12,000, how much bonus will be added to the total salary?
Signup and view all the answers
What is the significance of the statement 'else print num3' in the second program?
What is the significance of the statement 'else print num3' in the second program?
Signup and view all the answers
Study Notes
Program Overview
- Programs demonstrate basic concepts in C programming, including input/output operations, conditionals, loops, and arithmetic calculations.
Program 1: Hello World
- Simple program to print "Hello World".
- Uses
printf
function for output.
Program 2: ASCII Value
- Takes a character input and prints its ASCII value.
- Uses
%d
format specifier for integer representation.
Program 3: Sum and Average
- Takes two integer inputs, calculates and displays their sum and average.
- Average calculated by dividing the sum by 2.
Program 4: Total and Percentage of Marks
- Prompts user to enter marks for five subjects.
- Total and percentage are calculated from the entered marks.
- Uses integer division for total and float for percentage calculation.
Program 5: Check Odd or Even
- Checks if an entered number is odd or even.
- Uses a conditional statement to determine the result.
Program 6: Prime Number Check
- Determines if a number is prime.
- Loops from 2 to num/2 to check for factors.
Program 7: Salary Calculation Based on Sales
- Basic salary set at 1000.
- Bonuses and allowances depend on sales amount (e.g., different rates for sales above or below 10,000).
Program 8: Largest of Three Numbers
- Compares three numbers to find and display the largest.
- Uses conditional statements to determine the largest number.
Program 9: Positive, Negative, or Zero
- Takes a number as input and categorizes it as positive, negative, or zero.
- Employs nested conditional statements for categorization.
Program 10: Grade Calculation
- Not fully detailed but suggests checking grades based on input marks.
Additional Notes
- Correct use of
scanf
for reading inputs. - Importance of defining variable types and initializing variables properly.
- Emphasizes understanding conditional statements and loops for flow control in programs.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your knowledge of C programming with this quiz focused on calculating total and percentage from input marks in five subjects. Ideal for beginners learning about user input and basic arithmetic operations. See how well you understand fundamental programming concepts!