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() (A)</p> Signup and view all the answers

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

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

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

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

Which keyword is used to store whole numbers without decimals?

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

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

<p>sizeof() (D)</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() (B)</p> Signup and view all the answers

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

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

What is the typical bit width of a double variable?

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

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

<p>After the namespace std; (B)</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 (B)</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 (B)</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 (A)</p> Signup and view all the answers

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

<p>0 (C)</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 (D)</p> Signup and view all the answers

Which keyword specifies that a function takes no parameters?

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

What does unsigned int represent in C++?

<p>Integer value that can only be positive (B)</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 (A)</p> Signup and view all the answers

More Like This

Use Quizgecko on...
Browser
Browser