C++ Quiz 1

Description

control io, namespaces & data types.
Oscar Rojas
Quiz by Oscar Rojas, updated more than 1 year ago
Oscar Rojas
Created by Oscar Rojas about 4 years ago
1
0

Resource summary

Question 1

Question
Check all that are valid declarations:
Answer
  • long n = 100;
  • int a = 25
  • double {0.07};
  • unsigned __int16 = -69;
  • unsigned long double = 4.444;

Question 2

Question
What will the following code return: #include <iostream> int main() { __int16 t = 1400; std::cout << t + sizeof(t); }
Answer
  • 1402
  • 1416
  • 1432

Question 3

Question
Which of the following may not be of type void?
Answer
  • Objects
  • Arrays
  • Functions
  • References

Question 4

Question
The range of values that a 32 bit int can hold are from [+/- [blank_start]2,147,000,000[blank_end]]
Answer
  • 32,768
  • 1,200,000,000
  • 2,147,000,000
  • 9,000,000,000

Question 5

Question
List the Floating Point types from least to greatest: [blank_start]float, long double, double[blank_end]
Answer
  • double, long double, float
  • long double, double, float
  • double, float, long double
  • float, double, long double

Question 6

Question
Debug the following code: #include <iostream> #include <string> // Allows use of strings // [blank_start]missing namespaces[blank_end] int main() { std::string n; // [blank_start]Debug[blank_end] int num // [blank_start]Debug[blank_end] std::cout<<"Enter a #"<< std::endl; // [blank_start]Debug[blank_end] std::getline(cin, n); // [blank_start]Debug[blank_end] [blank_start]function[blank_end] >> num; } For lines w/o mistakes return 0
Answer
  • #include <sstream>
  • 0
  • int num;
  • 0
  • std::getline(std::cin, n);
  • std::stringstream n
Show full summary Hide full summary

Similar

Computing Hardware - CPU and Memory
ollietablet123
SFDC App Builder 2
Parker Webb-Mitchell
Data Types
Jacob Sedore
Intake7 BIM L1
Stanley Chia
Software Processes
Nurul Aiman Abdu
Design Patterns
Erica Solum
CCNA Answers – CCNA Exam
Abdul Demir
Abstraction
Shannon Anderson-Rush
Spyware
Sam2
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Data Analytics
anelvr