True or False? and explain why. C language
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
True or False? and explain why.
C language
![Code fragment 1:
int i=0;
int scores[]={0,0,0};
while(i<3)
{
printf("Scores: ");
scanf("%d", &scores[i]);
i++;
}
if((scores[0]<=scores[1])&&(scores[1]!=scores[2]))
{
scores[0]+=3;
printf("score 1: %d\n",scores[0]);
}
else if(!(scores[0]==20))
{
scores[1]-=2;
scores[i-2]=100;
for(i=0;i<30;i++)
{
printf("%d %d\n",scores[0], scores[1]);
}
}
else
{
printf("CTG currently doing DOTD on The Breakfast Club....\n");
}](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1e1c4d29-f99c-4688-a20d-95034dea0906%2F090b372f-caa6-4fc7-8591-64e129b2dc32%2Fpmk17on_processed.png&w=3840&q=75)
Transcribed Image Text:Code fragment 1:
int i=0;
int scores[]={0,0,0};
while(i<3)
{
printf("Scores: ");
scanf("%d", &scores[i]);
i++;
}
if((scores[0]<=scores[1])&&(scores[1]!=scores[2]))
{
scores[0]+=3;
printf("score 1: %d\n",scores[0]);
}
else if(!(scores[0]==20))
{
scores[1]-=2;
scores[i-2]=100;
for(i=0;i<30;i++)
{
printf("%d %d\n",scores[0], scores[1]);
}
}
else
{
printf("CTG currently doing DOTD on The Breakfast Club....\n");
}
![True or False:
11. If the value held at index 0 in the scores array is equal to the index of the array, we can say for certain
that the first if statement will execute.
12. We cannot say for sure what the value of i will be right after the while loop is done executing.
13. The else-if block will only execute if the value in index 0 equals 20.
14. scores[1]=printf("hello!"); would be a valid line of code.
15. In the else-if block, scores[i-2]=100; will always be updating the same index.
16. CTG currently doing DOTD on The Breakfast Club.... would be output to screen if the user enters the
numbers at the prompt in the while loop: 20, 7 and 6 (in that order)
17. We cannot say for sure how many times the for loop will execute if it starts.
18. If the for loop executes, we can say for sure what the value of the third argument in the print statement
(in the for loop) will be.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1e1c4d29-f99c-4688-a20d-95034dea0906%2F090b372f-caa6-4fc7-8591-64e129b2dc32%2F6gn377h_processed.png&w=3840&q=75)
Transcribed Image Text:True or False:
11. If the value held at index 0 in the scores array is equal to the index of the array, we can say for certain
that the first if statement will execute.
12. We cannot say for sure what the value of i will be right after the while loop is done executing.
13. The else-if block will only execute if the value in index 0 equals 20.
14. scores[1]=printf("hello!"); would be a valid line of code.
15. In the else-if block, scores[i-2]=100; will always be updating the same index.
16. CTG currently doing DOTD on The Breakfast Club.... would be output to screen if the user enters the
numbers at the prompt in the while loop: 20, 7 and 6 (in that order)
17. We cannot say for sure how many times the for loop will execute if it starts.
18. If the for loop executes, we can say for sure what the value of the third argument in the print statement
(in the for loop) will be.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education