If you're seeing this message, it means we're having trouble loading external resources on our website.
If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.
focusNode
Didn't know it?
click below
Knew it?
click below
Embed Code - If you would like this activity on your web page, copy the script below and paste it into
your web page.
Normal Size Small Size show me how
Introduction to Programming 04
Which structure is a logical design that controls the order in which a set of statements executes? | Control |
Consider the following statement: A store is giving a discount of 30% for all purchases of over $100. Which of the following is not an appropriate structure to use to program the statement? | Sequence |
The _______ symbol indicates that some condition must be tested in a flowchart. | Diamond |
What type of operator can be used to determine whether a specific relationship exists between two values? | Relational |
Which operator is used to determine that the operands are not exactly of the same value? | != |
Typically, in conditions that require checking if something is equivalent, the ______ operator is used instead of the assignment operator _____. | ==, = |
Which operator would make the following expression true? ____ false | NOT |
Which operator would make the following expression false? True _____ False | AND |
Which operator would make the following expression true? True _____ False | OR |
Which operator would make the following expression true? "Jane" _____ "Jeff" (>, <, ==, !=) | < |
Can someone help with these questions?
2 This type of operator determines whether a specific relationship exists between two values:
a.
Logical
b.
Mathematical
c.
Unary
d.
Relational
3. Which of the following expressions will determine whether x is less than or equal to y?
a.
x > y
b.
x =< y
c.
x <= y
d.
x >= y
4. Which one of the following is the not equal operator?
a.
<>
b.
NOT
c.
*&
d.
!=
5. What will be the value of x after the following code is executed?
int x = 75;
int y = 60;
if (x > y)
x = x - y;
a.
75
b.
15
c.
60
d.
135
6. What will be the value of ans after the following code has been executed?
int ans = 10;
int x = 65;
int y = 55;
if (x >= y)
ans = x + y;
a.
10
b.
120
c.
100
d.
No value, there is a syntax error
7. What will be the value of ans after the following code has been executed?
int x = 90, y = 55, ans = 10;
if ( x == y)
ans *= 2;
a.
10
b.
145
c.
20
d.
No value, there is a syntax error
8. A block of code is enclosed in a set of
a.
braces { }
b.
parentheses ( )
c.
double quotes " "
d.
brackets [ ]
9. If chr is a character variable, which of the following if statements is written correctly?
a.
if (chr = "a")
b.
if (chr == "a")
c.
if (chr = 'a')
d.
if (chr == 'a')
10. What would be the value of bonus after the following statements are executed?
int bonus, sales = 1250;
if (sales > 1000)
bonus = 100;
if (sales > 750)
bonus = 50;
if (sales > 500)
bonus = 25;
else
bonus = 0;
a.
100
b.
500
c.
25
d.
0
11. ____________ works like this: If the expression on the left side of the && operator is false, the expression the right side will not be checked.
a.
Short-circuit evaluation
b.
Reverse logic
c.
Boolean logic
d.
Relational evaluation
12. What is the value of x after the following code has been executed?
int x = 75;
int y = 90;
if ( x != y)
x += y;
a.
75
b.
90
c.
15
d.
165
13. What is the value of ans after the following code has been executed?
int x = 40;
int y = 40;
int ans = 0;
if (x = y)
ans = x + 10;
a.
50
b.
80
c.
30
d.
No value, this is a syntax error.
14. What is the value of ans after the following code has been executed?
int x = 35;
int y = 20, ans = 80;
if (x < y)
ans += y;
a.
80
b.
100
c.
35
d.
55
15 Which of the following correctly tests the char variable chr to determine whether it is not equal to the character B?
a.
if (chr > 'B')
b.
if (chr < 'B')
c.
if (chr != 'B')
d.
if (chr != "B")
Answer & Explanation
Solved by verified expert
Rated Helpful
<p>ec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam l</p> Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet
Unlock full access to Course Hero
Explore over 16 million step-by-step answers from our library
Subscribe to view answer
laoreet. Nam risus ante, dapibus a molesti
a mole
gue
gue
ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Done
itur laoree
onec aliqu
onec aliq
at, ultrices ac ma
amet
gue
gue
at, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Done
a molestie co
facilisis
a molestie
itur laoree
risus ante, dapibus
m ipsu
gue
gue
ce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dol
dictum vitae odio. Donec aliq
ce dui lectu
usce dui lectus,
icitu
gue
gue
gue
e vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem
rem ipsum dol
gue
gue
gue
ongue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipisc
iscing elit. Nam l
gue
gue
, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapib
ur laoreet. Nam risus a
e vel laoreet ac,
ce dui lectus, congu
ec aliquet. Lore
usce dui lectus, co
e vel laoreet a
usce dui lectus, co
ipsu
at, ultrices ac ma
iscin
gue
gue
ongue vel laoreet ac, dictum vitae
e vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellent
e vel laoreet a
gue
gue
, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar
itur laoree
ipiscing el
tesque dapib
, dictum vitae
trices
gue
ec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a mo
congue vel
usce dui l
sque dapibus
at, ultric
gue vel laoreet ac, d
pulv
gue
gue
gue
gue
gue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, c
fficitur la
dictum vitae odio. Do
inia pulvi
, consectetur adi
llent
gue
gue
ongue vel laoreet ac, dictum vitae
sus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliqu
molestie consequat
gue
Step-by-step explanation
ur laoreet. Nam risus ante, dapibus a m
ia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia p
Student review
100% (1 rating)