Which of the following is a way to put a comment into a C++ program?
/ comment /
Which of the following are ways to structure statements in most programming languages(more than one answer is possible here. you need to select them all)
Sequentially
Loop
Subprogram
Selection
01...
which of the following is a way to put a comment into a c program
which of the following are ways to structure statements in most programming languagesmo
Written for
CPE 211
All documents for this subject (9)
Seller
Follow
satamu
Reviews received
Content preview
CPE 211 Final exam
Which of the following is a way to put a comment into a C++ program? - Answer /*
comment */
Which of the following are ways to structure statements in most programming
languages(more than one answer is possible here. you need to select them all) -
Answer Sequentially
Loop
Subprogram
Selection
The implementation phase of computer programming involves which one of the
following: - Answer converting the algorithm steps into a programming language
The job of a compiler is to do what? - Answer translate a high level programming
language into machine language
Which of the following is a problem solving technique mentioned in the slides for
chapter 1? - Answer Divide and Conquer
An expression is an arrangement of ____________, _________________ and
______________ that can be evaluated to compute a value of a given type. - Answer
Operations
Literals
Identifiers
From the notes and text, "The set of rules determining the meaning of the instructions
written" is the definition for _______________________ - Answer Semantics
In C++ using strict ANSII standard C++ (and as mentioned for this course), identifiers
can start with what character(s) (more than one answer is possible)? - Answer
Underscores
Letters
In an assignment statement more than 1 variable can be present on the left hand side of
the statement - i.e. x + y =30; is a valid assignment statement - Answer False
Every C++ program must have a function named start - Answer True
The insertion operator << is used to insert information into the output file stream in C+
+? - Answer True
In C++ capitalization of identifiers does not matter because identifiers NAME and name
are considered to be the same identifier by the compiler? - Answer False
,In C++, which of the following operators are valid integer math operators? - Answer /
*
+
%
Which of the following are output file stream manipulators? - Answer setprecission
left
showpoint
What is the string value output by the output statement? - Answer third_Qu
Which of the following is a valid Named Constant Declaration in C++? - Answer const
string NAME = "Elm";
in C++ the following statement will increment num by 1?
num++; - Answer True
The following C++ statement is an example of type casting the integer variable num to a
floating point value:
int num;
float var;
var = (num)float; - Answer False
in C++ the result of the integer division of 6/4 is 1.5? - Answer False
Typically, information is lost when a floating point value is coerced to an integer value. -
Answer True
In C++ the following assignment statement is valid?
num1 = num2 = num3 = num4 = 0; - Answer True
in C++, void functions return a single function value? - Answer False
Which of the following statements will associate the file out.txt with the output file stream
variable outFile? (assume all variables and file streams have been declared correctly
and that all header files are present) - Answer outFile.open("out.txt");
, Which of the following functions is used to associate a file on the hard drive with a
declared file stream variable - Answer open
For the code segment below, what is the value output if the user types in 1 A 2 (select
the best possible answer)
int num1, num2, num3;]
cout << "Enter in 3 integers\n";
cin >> num1 >> num2 >> num3;
cout << num3; - Answer do not know - file stream went into fail state
The statement cin.get(ch); obtains the next character, regardless of what it is, from the
standard input stream cin? (ch is declared as a character variable) - Answer True
In C++ when using the open function, the argument for the open function must be a
string variable - Answer False
The ignore statement cin.ignore(20); will always ignore 20 characters on the input
stream cin? - Answer True
The two character sequence \n is used to represent the new line character in C++ and it
can be stroed in a character variable? - Answer True
The statement getline(cin, str1); reads an entire line ending in a ? into the string variable
str1? - Answer False
Before the code shown below is executed, the input stream (cin) contains the following
characters
(\n represents the new line character) :
500B\nHello 66\n44\n33and the reading marker is on the 5
Using the space provided, write what is output to the terminal by the following segment
of code.
int m = 10;
int x = 20;
string text = "Null";
char ch = 'A';getline(cin,text,'\n');
cin.ignore(5,'\n');
cin >> m >> ch;
cout << m << "-" << ch << "-" << x << "-" << text << endl;
xt << endl; - Answer 66-4-20-500B
In C++ any non-zero integer value is coerced to a boolean value of true - Answer True
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller satamu. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $8.49. You're not tied to anything after your purchase.