SlideShare a Scribd company logo
11.What is wrong with the following program that intends to calculate the average of student test
scores? Assume that the file DATA.TXT has several numeric entries.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim total, score, average, numItems As Double
Dim sr As IO.StreamReader = IO.File.OpenText("DATA.TXT")
total = 0
numItems = 0
score = CDbl(sr.ReadLine)
Do While sr.Peek <> -1
total += score
numItems += 1
score = CDbl(sr.ReadLine)
Loop
sr.Close()
average = total / numItems
txtBox.Text = CStr(average)
End Sub
Solution
The wrong with the given program which intends to calculate the average of student test scores is
that
The variable " score " is not initialized.

More Related Content

More from todd511

12- Heavy Rain Corporation just paid a dividend of $5-00 per share- an.docx
12- Heavy Rain Corporation just paid a dividend of $5-00 per share- an.docx12- Heavy Rain Corporation just paid a dividend of $5-00 per share- an.docx
12- Heavy Rain Corporation just paid a dividend of $5-00 per share- an.docx
todd511
 
13- Use the table below to write the name of the polymer and its use-.docx
13- Use the table below to write the name of the polymer and its use-.docx13- Use the table below to write the name of the polymer and its use-.docx
13- Use the table below to write the name of the polymer and its use-.docx
todd511
 
11-What will be the output of the following program when the button is.docx
11-What will be the output of the following program when the button is.docx11-What will be the output of the following program when the button is.docx
11-What will be the output of the following program when the button is.docx
todd511
 
12- Which of the following is a current liability- A) Preferred divid.docx
12- Which of the following is a current liability-  A) Preferred divid.docx12- Which of the following is a current liability-  A) Preferred divid.docx
12- Which of the following is a current liability- A) Preferred divid.docx
todd511
 
12- Mayberry engaged Williams as her agent-It was mutually agreed that.docx
12- Mayberry engaged Williams as her agent-It was mutually agreed that.docx12- Mayberry engaged Williams as her agent-It was mutually agreed that.docx
12- Mayberry engaged Williams as her agent-It was mutually agreed that.docx
todd511
 
12- Cholesteroi- of th a- a steroidb- a triterpenoidboth a and b Part.docx
12- Cholesteroi- of th a- a steroidb- a triterpenoidboth a and b Part.docx12- Cholesteroi- of th a- a steroidb- a triterpenoidboth a and b Part.docx
12- Cholesteroi- of th a- a steroidb- a triterpenoidboth a and b Part.docx
todd511
 
13- What is a cyber-attack- Give two examples of politically motivated.docx
13- What is a cyber-attack- Give two examples of politically motivated.docx13- What is a cyber-attack- Give two examples of politically motivated.docx
13- What is a cyber-attack- Give two examples of politically motivated.docx
todd511
 
13- An ester-containing lipid has four types of components (an alcohol.docx
13- An ester-containing lipid has four types of components (an alcohol.docx13- An ester-containing lipid has four types of components (an alcohol.docx
13- An ester-containing lipid has four types of components (an alcohol.docx
todd511
 
1S- N-N-diethyl-m-tolumide (DEET) is the active ingredient in many mos.docx
1S- N-N-diethyl-m-tolumide (DEET) is the active ingredient in many mos.docx1S- N-N-diethyl-m-tolumide (DEET) is the active ingredient in many mos.docx
1S- N-N-diethyl-m-tolumide (DEET) is the active ingredient in many mos.docx
todd511
 
19- All forms of energy- a) Either have the potential to move mass thr.docx
19- All forms of energy- a) Either have the potential to move mass thr.docx19- All forms of energy- a) Either have the potential to move mass thr.docx
19- All forms of energy- a) Either have the potential to move mass thr.docx
todd511
 
19- Which of the following should exhibit resonance- HCN CF4 BH3 SO2.docx
19- Which of the following should exhibit resonance-  HCN CF4 BH3 SO2.docx19- Which of the following should exhibit resonance-  HCN CF4 BH3 SO2.docx
19- Which of the following should exhibit resonance- HCN CF4 BH3 SO2.docx
todd511
 
19- (TCO 5) A minor review is (Points - 5) done as part of a majo.docx
19- (TCO 5) A minor  review is (Points - 5)     done as part of a majo.docx19- (TCO 5) A minor  review is (Points - 5)     done as part of a majo.docx
19- (TCO 5) A minor review is (Points - 5) done as part of a majo.docx
todd511
 
18- An independent auditor must have which of the following- A- A ba.docx
18- An independent auditor must have which of the following-   A- A ba.docx18- An independent auditor must have which of the following-   A- A ba.docx
18- An independent auditor must have which of the following- A- A ba.docx
todd511
 
16- Gwen the following information- calculate- a- Gross domestic produ.docx
16- Gwen the following information- calculate- a- Gross domestic produ.docx16- Gwen the following information- calculate- a- Gross domestic produ.docx
16- Gwen the following information- calculate- a- Gross domestic produ.docx
todd511
 
16- Which of the following is not true with respect to the auditors-'.docx
16- Which of the following is not true with respect to the auditors-'.docx16- Which of the following is not true with respect to the auditors-'.docx
16- Which of the following is not true with respect to the auditors-'.docx
todd511
 

More from todd511 (15)

12- Heavy Rain Corporation just paid a dividend of $5-00 per share- an.docx
12- Heavy Rain Corporation just paid a dividend of $5-00 per share- an.docx12- Heavy Rain Corporation just paid a dividend of $5-00 per share- an.docx
12- Heavy Rain Corporation just paid a dividend of $5-00 per share- an.docx
 
13- Use the table below to write the name of the polymer and its use-.docx
13- Use the table below to write the name of the polymer and its use-.docx13- Use the table below to write the name of the polymer and its use-.docx
13- Use the table below to write the name of the polymer and its use-.docx
 
11-What will be the output of the following program when the button is.docx
11-What will be the output of the following program when the button is.docx11-What will be the output of the following program when the button is.docx
11-What will be the output of the following program when the button is.docx
 
12- Which of the following is a current liability- A) Preferred divid.docx
12- Which of the following is a current liability-  A) Preferred divid.docx12- Which of the following is a current liability-  A) Preferred divid.docx
12- Which of the following is a current liability- A) Preferred divid.docx
 
12- Mayberry engaged Williams as her agent-It was mutually agreed that.docx
12- Mayberry engaged Williams as her agent-It was mutually agreed that.docx12- Mayberry engaged Williams as her agent-It was mutually agreed that.docx
12- Mayberry engaged Williams as her agent-It was mutually agreed that.docx
 
12- Cholesteroi- of th a- a steroidb- a triterpenoidboth a and b Part.docx
12- Cholesteroi- of th a- a steroidb- a triterpenoidboth a and b Part.docx12- Cholesteroi- of th a- a steroidb- a triterpenoidboth a and b Part.docx
12- Cholesteroi- of th a- a steroidb- a triterpenoidboth a and b Part.docx
 
13- What is a cyber-attack- Give two examples of politically motivated.docx
13- What is a cyber-attack- Give two examples of politically motivated.docx13- What is a cyber-attack- Give two examples of politically motivated.docx
13- What is a cyber-attack- Give two examples of politically motivated.docx
 
13- An ester-containing lipid has four types of components (an alcohol.docx
13- An ester-containing lipid has four types of components (an alcohol.docx13- An ester-containing lipid has four types of components (an alcohol.docx
13- An ester-containing lipid has four types of components (an alcohol.docx
 
1S- N-N-diethyl-m-tolumide (DEET) is the active ingredient in many mos.docx
1S- N-N-diethyl-m-tolumide (DEET) is the active ingredient in many mos.docx1S- N-N-diethyl-m-tolumide (DEET) is the active ingredient in many mos.docx
1S- N-N-diethyl-m-tolumide (DEET) is the active ingredient in many mos.docx
 
19- All forms of energy- a) Either have the potential to move mass thr.docx
19- All forms of energy- a) Either have the potential to move mass thr.docx19- All forms of energy- a) Either have the potential to move mass thr.docx
19- All forms of energy- a) Either have the potential to move mass thr.docx
 
19- Which of the following should exhibit resonance- HCN CF4 BH3 SO2.docx
19- Which of the following should exhibit resonance-  HCN CF4 BH3 SO2.docx19- Which of the following should exhibit resonance-  HCN CF4 BH3 SO2.docx
19- Which of the following should exhibit resonance- HCN CF4 BH3 SO2.docx
 
19- (TCO 5) A minor review is (Points - 5) done as part of a majo.docx
19- (TCO 5) A minor  review is (Points - 5)     done as part of a majo.docx19- (TCO 5) A minor  review is (Points - 5)     done as part of a majo.docx
19- (TCO 5) A minor review is (Points - 5) done as part of a majo.docx
 
18- An independent auditor must have which of the following- A- A ba.docx
18- An independent auditor must have which of the following-   A- A ba.docx18- An independent auditor must have which of the following-   A- A ba.docx
18- An independent auditor must have which of the following- A- A ba.docx
 
16- Gwen the following information- calculate- a- Gross domestic produ.docx
16- Gwen the following information- calculate- a- Gross domestic produ.docx16- Gwen the following information- calculate- a- Gross domestic produ.docx
16- Gwen the following information- calculate- a- Gross domestic produ.docx
 
16- Which of the following is not true with respect to the auditors-'.docx
16- Which of the following is not true with respect to the auditors-'.docx16- Which of the following is not true with respect to the auditors-'.docx
16- Which of the following is not true with respect to the auditors-'.docx
 

Recently uploaded

REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
TechSoup
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
OH TEIK BIN
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
ImMuslim
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
Celine George
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
Payaamvohra1
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
Celine George
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 

Recently uploaded (20)

REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptxA Free 200-Page eBook ~ Brain and Mind Exercise.pptx
A Free 200-Page eBook ~ Brain and Mind Exercise.pptx
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
 
How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17How to Download & Install Module From the Odoo App Store in Odoo 17
How to Download & Install Module From the Odoo App Store in Odoo 17
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 

11-What is wrong with the following program that intends to calculate.docx

  • 1. 11.What is wrong with the following program that intends to calculate the average of student test scores? Assume that the file DATA.TXT has several numeric entries. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim total, score, average, numItems As Double Dim sr As IO.StreamReader = IO.File.OpenText("DATA.TXT") total = 0 numItems = 0 score = CDbl(sr.ReadLine) Do While sr.Peek <> -1 total += score numItems += 1 score = CDbl(sr.ReadLine) Loop sr.Close() average = total / numItems txtBox.Text = CStr(average) End Sub Solution
  • 2. The wrong with the given program which intends to calculate the average of student test scores is that The variable " score " is not initialized.