Deck 1: C++ Basics
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/37
العب
ملء الشاشة (f)
Deck 1: C++ Basics
1
C++ uses only /* */ for comments.
False
2
A program should have a comment on every line.
False
3
The most difficult programming language construct to learn to use properly is the comment.
True
4
To put a character into a cstring constant that causes the output to continue on the next line,insert the escape sequence \t into the string constant.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
5
In C++ you can assign an expression of type double to a variable of type int with no problem.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
6
A computer program is a set of instructions intended for only the computer to follow.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
7
C++ not only supports OOP but also supports other programming styles.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
8
A program's comments should connect the program code to the problem being solved.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
9
The names x,y,and z are satisfactory variable names for the lengths of the legs and hypotenuse of a triangle.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
10
If we execute this code in an otherwise correct and complete program:
n = 1;
n = (n++)+ (n++);
the value of n is guaranteed to be 3 after the second line executes.
n = 1;
n = (n++)+ (n++);
the value of n is guaranteed to be 3 after the second line executes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
11
In C++ the variables Alpha,ALPHA and AlphA are the same identifier.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
12
The namespace facility is a tool used that assists in the study of genealogy.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
13
OOP is an acronym that means Object Oriented Programming.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
14
In C++ the compiler will infer the type intended for a variable from the context in which the variable occurs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
15
Comments have no value whatsoever and do not belong in a program.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
16
In C++ you can assign an expression of type int to a variable of type double with no problem.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
17
A C++ declaration is a definition that also allocates storage for an identifier's value (or function's body etc. ).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
18
The range of values for an int variable is from about 0 to +2 billion.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
19
If we execute the code fragment in an otherwise complete,correct program:
n = 1;
cout << n++ << " " << n++ << " " << n++ << endl;
the output is guaranteed to be 1 2 3.
n = 1;
cout << n++ << " " << n++ << " " << n++ << endl;
the output is guaranteed to be 1 2 3.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
20
A C++ declaration introduces only an identifier's spelling and specifies its type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
21
When you use a double,what is doubled? When you use a long int,how much longer is the long int than an int? Comment.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
22
Give the declaration for two variables,feet and inches.Declare each to be of type int,and both initialized to zero in the declaration.Give both initialization alternatives.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
23
In C++,a legal identifiers may contain these kinds of characters _______________,______________,______________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
24
Which of the following are likely to be poor choices for an identifier in a program? Why?
a)x
b)RATE
c)data
d)_abc
e)A
a)x
b)RATE
c)data
d)_abc
e)A
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which of the following will properly encode the string "\w\\\t" into variable s?
A)s = "\w\\\t";
B)s = R"(\w\\\t)";
C)s = "\\w\\\\\\t";
D)s = "/w///t";
A)s = "\w\\\t";
B)s = R"(\w\\\t)";
C)s = "\\w\\\\\\t";
D)s = "/w///t";
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
26
What is the value assigned to the variable in each of these cases? Explain curious results.Be careful!
int x,y;
a)x = 1/2;
b)y = 3.0/2.0;
double z,w,t;
c)z = 1/2;
d)w = 3/2;
e)t = 3.0/2.0;
int x,y;
a)x = 1/2;
b)y = 3.0/2.0;
double z,w,t;
c)z = 1/2;
d)w = 3/2;
e)t = 3.0/2.0;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
27
An r-value is
A)an expression that can be only placed on the right of any operator such as +,*,/ etc.
B)can never be assigned a value
C)can have a value fetched from it
D)is designed for use by a right-handed person.
A)an expression that can be only placed on the right of any operator such as +,*,/ etc.
B)can never be assigned a value
C)can have a value fetched from it
D)is designed for use by a right-handed person.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
28
Write a C++ program that outputs "My first C++ program" and then outputs a carriage return.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
29
What is the data type of variable x in the following C++11 code: int y= 2;
Double z = 3.5;
Auto x = z * y;
A)int
B)double
C)auto
D)syntax error
Double z = 3.5;
Auto x = z * y;
A)int
B)double
C)auto
D)syntax error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
30
Given the C++ output statements.What is the output of these lines of code? Explain.
cout << "If you have ";
cout << "a number of pods ";
cout << "you can quit.";
cout << "\n";
cout << "If you have ";
cout << "a number of pods ";
cout << "you can quit.";
cout << "\n";
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
31
What is the difference between a warning from the compiler and an error message from the compiler?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
32
What does the line
#include
do for your program?
#include
do for your program?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
33
Identifiers should at least give a hint to the human reader of the ________________ of the identifier in the context of the problem being solved.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
34
In the history of the C++ language,what was the immediate predecessor of the C++ language? How is this older language related to C++?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
35
Write a short program that contains statements to output the values of a variable that you define but neither initialize nor assign.Discuss the output you get.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
36
The C++ very nearly contains the ______ programming language as proper subset.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck
37
With C++11 and higher what data type can you use to guarantee that 32 bits will be used to store a signed integer?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 37 في هذه المجموعة.
فتح الحزمة
k this deck