Operators and Primitive Data Types
20 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 operator is used to add together two values?

  • %
  • + (correct)
  • /
  • *
  • Which keyword is used to store either True or False?

  • double
  • bool (correct)
  • char
  • int
  • What function is used to read a string or a line from an input stream?

  • endl
  • cin
  • getLine (correct)
  • wcslen()
  • Which function returns the length of the given wide string?

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

    Which keyword is used to store a sequence of letters or other characters?

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

    What is the operator used to decrease the value of a variable by 1?

    <p>--x</p> Signup and view all the answers

    Which keyword is used to store whole numbers without decimals?

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

    What is the function used to get the size of various data types?

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

    What is used to set the decimal precision to be used to format floating point values on output operations?

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

    Which keyword is used to store fractional numbers containing one or more decimals?

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

    What is the typical bit width of a double variable?

    <p>8 bytes</p> Signup and view all the answers

    When should the setprecision() function be used in the source code?

    <p>After the namespace std;</p> Signup and view all the answers

    What is the purpose of the getline() function?

    <p>To read a line of text from an input stream and store it in a string variable</p> Signup and view all the answers

    What does the void keyword indicate when used as a function return type?

    <p>The function doesn't return a value</p> Signup and view all the answers

    What is the purpose of the putback function in C++?

    <p>To put a character back into the input stream</p> Signup and view all the answers

    What does the array indexing start at in C++?

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

    What is the purpose of the peek function in C++?

    <p>To read the next character from the input stream only</p> Signup and view all the answers

    Which keyword specifies that a function takes no parameters?

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

    What does unsigned int represent in C++?

    <p>Integer value that can only be positive</p> Signup and view all the answers

    What is the maximum and minimum value that can be stored in a long double variable?

    <p>-1.7 x 10^308 to 1.7 x 10^308</p> Signup and view all the answers

    More Like This

    Use Quizgecko on...
    Browser
    Browser