C Assignment Operators Quiz
10 Questions
1 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the purpose of the 'scanf()' function in C?

  • To display output to the user
  • To calculate mathematical operations
  • To take user input (correct)
  • To declare variables
  • What does the '&' sign before a variable represent in C?

  • Indicates multiplication
  • Is used for increasing the value by 1
  • Denotes the power operator
  • Represents the address of the variable (correct)
  • Why is '%f' used in the 'scanf()' function for floats?

  • To indicate a character input
  • To calculate mathematical operations
  • For storing integer values
  • To represent float values (correct)
  • What does the conversion format string '%c' do in C?

    <p>Reads and displays characters</p> Signup and view all the answers

    When using '%d' for 'printf()', what type of value is expected to be displayed?

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

    What is the major difference between '%c' and '%d' conversion format strings?

    <p>'%c' displays characters directly, '%d' displays integers directly</p> Signup and view all the answers

    In C, what does 'scanf("%c",&var1)' do?

    <p>Reads and displays a character</p> Signup and view all the answers

    What does the 'return 0;' statement signify within 'main()' function in C?

    <p>'return 0;' indicates successful execution of the program</p> Signup and view all the answers

    What will be displayed when using 'printf("ASCII value of %d", var1);' in C?

    <p>ASCII value of the input character as an integer</p> Signup and view all the answers

    When taking user input using 'scanf("%f", &a);', what data type is 'a' assumed to be?

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

    Use Quizgecko on...
    Browser
    Browser