🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

C Programming: Marks Calculation Quiz
21 Questions
0 Views

C Programming: Marks Calculation Quiz

Created by
@KindlyOganesson

Podcast Beta

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the purpose of the program that prints 'Hello World'?

  • To accept user input before displaying a message.
  • To convert a character to its ASCII equivalent.
  • To calculate the sum of two numbers and display it.
  • To display a greeting message to the user. (correct)
  • What is the output of the program that calculates the ASCII value of a character when 'c' is entered?

  • 67
  • 99 (correct)
  • 9
  • 100
  • In the program that calculates the sum and average of two numbers, which line correctly calculates the average?

  • avg = (a + b) / 2.0;
  • avg = (a + b) / 3;
  • avg = (a + b) * 2;
  • avg = (a + b) / 2; (correct)
  • What is missing from the program that calculates total and percentage of marks for 5 subjects?

    <p>Printing the total and percentage.</p> Signup and view all the answers

    What is the data type of the variable 'avg' used in the program that calculates sum and average?

    <p>float</p> Signup and view all the answers

    What is the purpose of the statement 'percent = total/5;' in the source code?

    <p>To calculate the average marks per subject.</p> Signup and view all the answers

    What will be the output for the entered number 0 in the even/odd program?

    <p>Given number 0 is even</p> Signup and view all the answers

    Which part of the program checks whether the number is prime?

    <p>The loop from 2 to num / 2</p> Signup and view all the answers

    What condition would lead to a 'not prime' classification for the number 9 in the prime-checking program?

    <p>If it is divisible by any number other than 1 and itself</p> Signup and view all the answers

    What bonus does the program assign if sales are below 10,000?

    <p>200</p> 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?

    <p>100</p> Signup and view all the answers

    What is the primary use of a conditional statement in programming?

    <p>To execute code only if a specific condition is met</p> Signup and view all the answers

    Which function is used to read input from the user in the given programs?

    <p>scanf()</p> Signup and view all the answers

    What will be the total salary if the sales amount entered is 9,000?

    <p>1,900.00</p> Signup and view all the answers

    In the second program, what will happen if the input numbers are 5, 5, and 5?

    <p>The program will print 5.</p> Signup and view all the answers

    What is the output of the program when the input number is -10?

    <p>The given number -10 is negative.</p> Signup and view all the answers

    Which statement about the total salary calculation is incorrect?

    <p>Basic salary is excluded from the total salary calculation.</p> Signup and view all the answers

    What will be printed when the input is 0 in the third program?

    <p>The given number 0 is zero.</p> Signup and view all the answers

    How will the largest number be determined in the second program?

    <p>By checking conditions for all three numbers.</p> Signup and view all the answers

    If the sales amount entered is 12,000, how much bonus will be added to the total salary?

    <p>500</p> Signup and view all the answers

    What is the significance of the statement 'else print num3' in the second program?

    <p>It is a catch-all for when num1 and num2 are not greater.</p> 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.

    Quiz Team

    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!

    Use Quizgecko on...
    Browser
    Browser