Deck 2: C++ Basics

ملء الشاشة (f)
exit full mode
سؤال
if-else statements that are inside other if-else statements are said to be _______________.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Is << used for input or output? ____________
سؤال
Every line in a program should have a comment.
سؤال
It is legal to declare more than one variable in a single statement.
سؤال
Each time a loop body executes is known as an _______________________.
سؤال
The body of a while loop may never execute.
سؤال
The opposite of less than is greater than
سؤال
Variable names may begin with a number.
سؤال
In the following code fragment,x has the value of 3.
int x = 3;
سؤال
<< is called the stream ____________________ operator.
سؤال
The integer 0 is considered true.
سؤال
What is the correct conditional statement to determine if x is between 19 and 99? __________________
سؤال
The opposite of x >3 && x < 10)is x < 3 && x > 10)
سؤال
The stream that is used for input from the keyboard is called ___________.
سؤال
Loops are used when we need our program to make a choice between two or more things.
سؤال
A loop that always executes the loop body at least once is known as a _____________ loop.
سؤال
What is the opposite of x < 20 && x > 12)? _______________________
سؤال
The body of a do-while loop always executes at least once.
سؤال
int myValue; is called a _______________________.
سؤال
>> is known as the stream ____________ operator.
سؤال
Which of the following statements is NOT legal?

A)char ch='b';
B)char ch='0';
C)char ch=65;
D)char ch="cc";
سؤال
What is the value of x after the following statements?
Int x;
X = x + 30;

A)0
B)30
C)33
D)garbage
سؤال
In a compound logical and &&)expression,the evaluation of the expression stops once one of the terms of the expression is false.This is known as ______________ evaluation.
سؤال
What is the value of x after the following statements?
Int x,y,z;
Y = 10;
Z = 3;
X = y * z + 3;

A)Garbage
B)60
C)30
D)33
سؤال
What is the value of x after the following statement?
Float x;
X = 3.0 / 4.0 + 3 + 2 )/ 5

A)5.75
B)5.75
C)1.75
D)3.75
سؤال
What is the output of the following code?
Float value;
Value = 33.5;
Cout << value << endl;

A)33.5
B)33
C)value
D)garbage
سؤال
What is the output of the following code?
Cout << "This is a \\" << endl;

A)This is a
B)This is a \
C)nothing,it is a syntax error
D)This is a \ endl
سؤال
Which of the following is a valid identifier?

A)3com
B)three_com
C)3_com
D)3-com
E)dollar$
سؤال
Which of the following is not a valid identifier?

A)return
B)myInt
C)myInteger
D)total3
سؤال
The stream that is used for output to the screen is called ___________.
سؤال
Another way to write the value 3452211903 is

A)3.452211903e09
B)3.452211903e-09
C)3.452211903x09
D)3452211903e09
سؤال
Which of the following lines correctly reads a value from the keyboard and stores it in the variable named myFloat?

A)cin > > myFloat;
B)cin << myFloat;
C)cin >> "myFloat";
D)cin >> myFloat >> endl;
سؤال
What is the value of x after the following statement?
Float x;
X = 3.0 / 4.0 + 3 + 2 / 5

A)5.75
B)5.75
C)1.75
D)3.75
سؤال
What is the value of x after the following statements?
Float x;
X = 15/4;

A)3.75
B)4.0
C)3.0
D)60
سؤال
Write the loop condition to continue a while loop as long as x is negative.____________________
سؤال
What is the value of x after the following statements?
Int x;
X = 15 %4;

A)15
B)4
C)3
D)3.75
سؤال
What is the value of x after the following statements?
Int x;
X = 0;
X = x + 30;

A)0
B)30
C)33
D)garbage
سؤال
What is the output of the following code?
Float value;
Value = 33.5;
Cout << "value" << endl;

A)33.5
B)33
C)value
D)garbage
سؤال
When must we use braces to define the body of a contitional expression? ______________
سؤال
What is the value of x after the following statements?
Int x;
X = 15/4;

A)15
B)3
C)4
D)3.75
سؤال
Given the following code fragment,what is the final value of y?
Int x,y;
X = -1;
Y = 0;
Whilex <= 3)
{
Y += 2;
X += 1;
}

A)2
B)10
C)6
D)8
سؤال
Given the following code fragment,what is the output?
Int x=5;
If x > 5)
Cout << "x is bigger than 5.";
Cout <<"That is all.";
Cout << "Goodbye\n";

A)x is bigger than 5.That is all
B)x is bigger than 5
C)That is all.Goodbye
D)Goodbye
سؤال
Given the following code fragment,and an input value of 3,what is the output that is generated?
int x;
cout <<"Enter a value\n";
cin >> x;
ifx=0)
{
cout << "x is zero\n";
}
else
{
cout << "x is not zero\n";
}
a.x is zero
b.x is not zero
c.unable to determine
d.x is 3
سؤال
Given the following code fragment,which of the following expressions is always true?
Int x;
Cin >> x;

A)if x < 3)
B)if x==1)
C)if x / 3)>1 )
D)if x = 1)
سؤال
If x has the value of 3,y has the value of -2,and w is 10,is the following condition true or false?
If x < 2 && w < y)

A)true
B)false
سؤال
Given the following code fragment and the input value of 4.0,what output is generated?
Float tax;
Float total;
Cout << "enter the cost of the item\n";
Cin >> total;
If total >= 3.0)
{
Tax = 0.10;
Cout << total + total * tax)<< endl;
}
Else
{
Cout << total << endl;
}

A)3
B)3.3
C)4.0
D)4.4
سؤال
What is the value of x after the following statements?
Double x;
X = 0;
X += 3.0 * 4.0;
X -= 2.0;

A)22.0
B)12.0
C)10.0
D)14.0
سؤال
What is the correct way to write the condition y < x < z?

A)y < x < z)
B)y < x)&& z)
C)y > x)|| y < z))
D)y < x)&& x < z))
سؤال
Executing one or more statements one or more times is known as:

A)selection
B)iteration
C)sequence
D)algorithm
سؤال
Given the following code fragment,what is the final value of y?
Int x,y;
X = -1;
Y = 0;
Whilex < 3)
{
Y += 2;
X += 1;
}

A)2
B)10
C)6
D)8
سؤال
Given the following code fragment,and an input value of 5,what is the output?
Int x;
If x< 3)
{
Cout << "small\n";
}
Else
{
If x < 4)
{
Cout << "medium\n";
}
Else
{
If x < 6)
{
Cout << "large\n";
}
Else
{
Cout << "giant\n";
}
}
}

A)small
B)medium
C)large
D)giant
سؤال
Given the following code fragment and the input value of 2.0,what output is generated?
Float tax;
Float total;
Cout << "enter the cost of the item\n";
Cin >> total;
If total >= 3.0)
{
Tax = 0.10;
Cout << total + total * tax)<< endl;
}
Else
{
Cout << total << endl;
}

A)2.2
B)2.0
C)3.1
D)4.4
سؤال
What is the output of the following code fragment?
int x=0;
while x < 5)
cout << x << endl;
x ++;
cout << x << endl;
a.0
b.5
c.4
d.unable to determine
سؤال
What is the final value of x after the following fragment of code executes?
Int x=0;
Do
{
X++;
}whilex > 0);

A)8
B)9
C)10
D)11
E)infinite loop.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/54
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 2: C++ Basics
1
if-else statements that are inside other if-else statements are said to be _______________.
nested
2
Is << used for input or output? ____________
output
3
Every line in a program should have a comment.
False
4
It is legal to declare more than one variable in a single statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
5
Each time a loop body executes is known as an _______________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
6
The body of a while loop may never execute.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
7
The opposite of less than is greater than
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
8
Variable names may begin with a number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
9
In the following code fragment,x has the value of 3.
int x = 3;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
10
<< is called the stream ____________________ operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
11
The integer 0 is considered true.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
12
What is the correct conditional statement to determine if x is between 19 and 99? __________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
13
The opposite of x >3 && x < 10)is x < 3 && x > 10)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
14
The stream that is used for input from the keyboard is called ___________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
15
Loops are used when we need our program to make a choice between two or more things.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
16
A loop that always executes the loop body at least once is known as a _____________ loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
17
What is the opposite of x < 20 && x > 12)? _______________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
18
The body of a do-while loop always executes at least once.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
19
int myValue; is called a _______________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
20
>> is known as the stream ____________ operator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following statements is NOT legal?

A)char ch='b';
B)char ch='0';
C)char ch=65;
D)char ch="cc";
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
22
What is the value of x after the following statements?
Int x;
X = x + 30;

A)0
B)30
C)33
D)garbage
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
23
In a compound logical and &&)expression,the evaluation of the expression stops once one of the terms of the expression is false.This is known as ______________ evaluation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
24
What is the value of x after the following statements?
Int x,y,z;
Y = 10;
Z = 3;
X = y * z + 3;

A)Garbage
B)60
C)30
D)33
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
25
What is the value of x after the following statement?
Float x;
X = 3.0 / 4.0 + 3 + 2 )/ 5

A)5.75
B)5.75
C)1.75
D)3.75
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
26
What is the output of the following code?
Float value;
Value = 33.5;
Cout << value << endl;

A)33.5
B)33
C)value
D)garbage
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
27
What is the output of the following code?
Cout << "This is a \\" << endl;

A)This is a
B)This is a \
C)nothing,it is a syntax error
D)This is a \ endl
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
28
Which of the following is a valid identifier?

A)3com
B)three_com
C)3_com
D)3-com
E)dollar$
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which of the following is not a valid identifier?

A)return
B)myInt
C)myInteger
D)total3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
30
The stream that is used for output to the screen is called ___________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
31
Another way to write the value 3452211903 is

A)3.452211903e09
B)3.452211903e-09
C)3.452211903x09
D)3452211903e09
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
32
Which of the following lines correctly reads a value from the keyboard and stores it in the variable named myFloat?

A)cin > > myFloat;
B)cin << myFloat;
C)cin >> "myFloat";
D)cin >> myFloat >> endl;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
33
What is the value of x after the following statement?
Float x;
X = 3.0 / 4.0 + 3 + 2 / 5

A)5.75
B)5.75
C)1.75
D)3.75
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
34
What is the value of x after the following statements?
Float x;
X = 15/4;

A)3.75
B)4.0
C)3.0
D)60
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
35
Write the loop condition to continue a while loop as long as x is negative.____________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
36
What is the value of x after the following statements?
Int x;
X = 15 %4;

A)15
B)4
C)3
D)3.75
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
37
What is the value of x after the following statements?
Int x;
X = 0;
X = x + 30;

A)0
B)30
C)33
D)garbage
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
38
What is the output of the following code?
Float value;
Value = 33.5;
Cout << "value" << endl;

A)33.5
B)33
C)value
D)garbage
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
39
When must we use braces to define the body of a contitional expression? ______________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
40
What is the value of x after the following statements?
Int x;
X = 15/4;

A)15
B)3
C)4
D)3.75
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
41
Given the following code fragment,what is the final value of y?
Int x,y;
X = -1;
Y = 0;
Whilex <= 3)
{
Y += 2;
X += 1;
}

A)2
B)10
C)6
D)8
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
42
Given the following code fragment,what is the output?
Int x=5;
If x > 5)
Cout << "x is bigger than 5.";
Cout <<"That is all.";
Cout << "Goodbye\n";

A)x is bigger than 5.That is all
B)x is bigger than 5
C)That is all.Goodbye
D)Goodbye
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
43
Given the following code fragment,and an input value of 3,what is the output that is generated?
int x;
cout <<"Enter a value\n";
cin >> x;
ifx=0)
{
cout << "x is zero\n";
}
else
{
cout << "x is not zero\n";
}
a.x is zero
b.x is not zero
c.unable to determine
d.x is 3
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
44
Given the following code fragment,which of the following expressions is always true?
Int x;
Cin >> x;

A)if x < 3)
B)if x==1)
C)if x / 3)>1 )
D)if x = 1)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
45
If x has the value of 3,y has the value of -2,and w is 10,is the following condition true or false?
If x < 2 && w < y)

A)true
B)false
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
46
Given the following code fragment and the input value of 4.0,what output is generated?
Float tax;
Float total;
Cout << "enter the cost of the item\n";
Cin >> total;
If total >= 3.0)
{
Tax = 0.10;
Cout << total + total * tax)<< endl;
}
Else
{
Cout << total << endl;
}

A)3
B)3.3
C)4.0
D)4.4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
47
What is the value of x after the following statements?
Double x;
X = 0;
X += 3.0 * 4.0;
X -= 2.0;

A)22.0
B)12.0
C)10.0
D)14.0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
48
What is the correct way to write the condition y < x < z?

A)y < x < z)
B)y < x)&& z)
C)y > x)|| y < z))
D)y < x)&& x < z))
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
49
Executing one or more statements one or more times is known as:

A)selection
B)iteration
C)sequence
D)algorithm
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
50
Given the following code fragment,what is the final value of y?
Int x,y;
X = -1;
Y = 0;
Whilex < 3)
{
Y += 2;
X += 1;
}

A)2
B)10
C)6
D)8
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
51
Given the following code fragment,and an input value of 5,what is the output?
Int x;
If x< 3)
{
Cout << "small\n";
}
Else
{
If x < 4)
{
Cout << "medium\n";
}
Else
{
If x < 6)
{
Cout << "large\n";
}
Else
{
Cout << "giant\n";
}
}
}

A)small
B)medium
C)large
D)giant
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
52
Given the following code fragment and the input value of 2.0,what output is generated?
Float tax;
Float total;
Cout << "enter the cost of the item\n";
Cin >> total;
If total >= 3.0)
{
Tax = 0.10;
Cout << total + total * tax)<< endl;
}
Else
{
Cout << total << endl;
}

A)2.2
B)2.0
C)3.1
D)4.4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
53
What is the output of the following code fragment?
int x=0;
while x < 5)
cout << x << endl;
x ++;
cout << x << endl;
a.0
b.5
c.4
d.unable to determine
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
54
What is the final value of x after the following fragment of code executes?
Int x=0;
Do
{
X++;
}whilex > 0);

A)8
B)9
C)10
D)11
E)infinite loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 54 في هذه المجموعة.