stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
C++ Week 2- Input Output Flashcards | StudBud
Explore
/
C++ Week 2- Input Output
C++ Week 2- Input Output
20 terms
·
StudBud Administration
·
14 plays
Test your knowledge on fundamental concepts of C++ programming language
Flashcards
20 cards
F
Practice quiz
P
Host live
L
Questions
20
Answers
1
Is the getline() function used to read a line of text from the input stream in C++?
True
False
2
C++ uses semicolons to end statements.
False
True
3
What is the output of cout << 3 + 2;?
Error
5
cout
cout
4
What does 'return 0;' signify?
Error occurred
Return of the Jedi
Successful execution
End of function
5
What is the purpose of endl?
End program
Comment line
New line
Variable declaration
6
How is the getline function different from the cin >> operator in C++?
getline is used for input, while cin >> is used for output
getline reads only a single word, while cin >> reads a whole line of text
getline is used for output, while cin >> is used for input
getline reads a whole line of text, while cin >> reads only a single word
7
What is the purpose of 'getline'?
Read entire line
Read character
Read array
Read integer
8
What is the output of cout << "5" + "2";?
Error
cout
cout
52
9
What is the purpose of the getline function in C++?
To read a line of text from the input stream
To write a line of text to the output stream
To perform mathematical calculations
To create a new variable
10
What is the output of cout << 5;?
None
"5"
5.0
5
11
Which of the following is a user-defined data type in C++?
array
struct
double
int
12
Which of the following is a primitive data type in C++?
class
struct
int
enum
13
What is the output of cout << "Hello" << "World";?
HelloWorld
Hello World
Hello World
cout
14
What is the syntax for printing "Hello, World!" to the console in C++?
System.out.println("Hello, World!");
print("Hello, World!");
cout
printf("Hello, World!");
15
Which operator is used for output in C++?
&&
Empty choice
>>
::
16
How to read a string in C++?
str = cin;
str
cin >> str;
getline(cin, str);
17
Can the getline function be used to read input from a file in C++?
Yes, but only if the file is in binary format
Yes, getline can be used to read input from a file
No, getline can only be used for keyboard input
No, getline can only be used for output to a file
18
What does the '>>' operator do?
Input stream
Assignment
Output stream
Comparison
19
Which of the following is a derived data type in C++?
class
int
enum
struct
20
How to read multiple values?
cin >> a >> b;
scanf();
getline(cin, str);
cin.get();