32.7 (Populate Quiz table) Create a table named Quiz as follows: create table Qu
ID: 3686119 • Letter: 3
Question
32.7 (Populate Quiz table) Create a table named Quiz as follows:
create table Quiz(
questionId int,
question varchar(4000),
choicea varchar(1000),
choiceb varchar(1000),
choicec varchar(1000),
choiced varchar(1000),
answer varchar(5));
The Quiz table stores multiple-choice questions. Suppose the multiple-choice
questions are stored in a text file accessible from www.cs.armstrong.edu/liang/data/
Quiz.txt in the following format:
1. question1
a. choice a
b. choice b
c. choice c
d. choice d
Answer:cd
2. question2
a. choice a
b. choice b
c. choice c
d. choice d
Answer:a
...
Write a Java program that reads the data from the file and populate it into the Quiz
table.
This is the text from the text file from the link :
Explanation / Answer
//Quiz.java
//Program that reads the data from the test.txt file and populate it into the Quiz table.
//we have to use test.txt file which must be saved in the same directory of Quiz.java
import java.io.*;
public class Quiz
{
public static void main(String args[]) throws IOException
{
FileInputStream fis = new FileInputStream("test.txt");
int c;
while((c=fis.read())!=-1) //to read all the contents of the test.txt file
{
System.out.print((char)c);
}
}
}
//we have to creat test.txt file which contains the Quiz contents
//test.txt file
1. ________ is the physical aspect of the computer that can be seen.
a. Hardware
b. Software
c. Operating system
d. Application program
Answer:a
2. __________ is the brain of a computer.
a. Hardware
b. CPU
c. Memory
d. Disk
Answer:b
3. The speed of CPU is measured in __________.
public class A {
}
a. megabytes
b. gigabytes
c. megahertz
d. gigahertz
Answer:cd
4. Why do computers use zeros and ones?
a. because combinations of zeros and ones can represent any numbers and characters.
b. because digital devices have two stable states and it is natural to use one state for 0 and the other for 1.
c. because binary numbers are simplest.
d. because binary numbers are the bases upon which all other number systems are built.
Answer:b
5. One byte has ________ bits.
a. 4
b. 8
c. 12
d. 16
Answer:b
6. A 3.5-inch floppy can hold up to _________ bytes.
a. 0.5 MB.
b. 1.44 MB.
c. 10 MB.
d. 100 MB.
Answer:b
7. A regular CD-ROM can hold up to _________ bytes.
a. 100 MB.
b. 700 MB.
c. 1 GB.
d. 10 GB.
Answer:b
8. ____________ is a device to connect a computer to a local area network (LAN).
a. regular modem
b. DSL
c. Cable modem
d. NIC
Answer:d
9. ____________ are instructions to the computer.
a. Hardware
b. Software
c. Programs
d. Keyboards
Answer:bc
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.