1 - Humble ISD

Download Report

Transcript 1 - Humble ISD

PreAP Computer Science
Quiz 02.07-10
Take out a piece of paper and PEN.
The quiz starts ONE minute after
the tardy bell rings.
You will have 30 or 45 seconds
per question.
Title the quiz as shown below
The quiz starts in ONE minute.
Name
Period
Date
Quiz 02.07-10
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
EC.
Question 01
Which lines in this program contain comments?
#1 // Java0201.java
#2 // This program demonstrates text output with println.
#3 // Note how the file name, Java0201, is the same as the
#4 // class identifier Java0201.
#5 // Make sure that you observe "case-sensitivity".
#6 public class Java0201
#7 {
(a) Lines 1-5
#8
public static void main (String args[])
(b) Lines 7-9
#9
{
#10
System.out.println("Hello World!"); (c) Lines 10-12
#11 }
(d) Lines 7, 9, 11, 12
#12 }
Question 02
Which line in this program generates output?
#1 // Java0201.java
#2 // This program demonstrates text output with println.
#3 // Note how the file name, Java0201, is the same as the
#4 // class identifier Java0201.
#5 // Make sure that you observe "case-sensitivity".
#6 public class Java0201
#7 {
(a) Line
#8
public static void main (String args[])
(b) Line
#9
{
#10
System.out.println("Hello World!");
(c) Line
#11 }
(d) Line
#12 }
1
6
8
10
Question 03
Which line in this program must contain the name of the file?
#1 // Java0201.java
#2 // This program demonstrates text output with println.
#3 // Note how the file name, Java0201, is the same as the
#4 // class identifier Java0201.
#5 // Make sure that you observe "case-sensitivity".
#6 public class Java0201
#7 {
(a) Line
#8
public static void main (String args[])
(b) Line
#9
{
#10
System.out.println("Hello World!");
(c) Line
#11 }
(d) Line
#12 }
1
6
8
10
Question 04
Which word from this program is not a Java Reserved Word?
#1 // Java0201.java
#2 // This program demonstrates text output with println.
#3 // Note how the file name, Java0201, is the same as the
#4 // class identifier Java0201.
#5 // Make sure that you observe "case-sensitivity".
#6 public class Java0201
#7 {
(a) public
#8
public static void main (String args[])
(b) static
#9
{
#10
System.out.println("Hello World!");
(c) void
#11 }
(d) Java0201
#12 }
Question 05
Which symbol is used for single-line comments?
(a) //
(b) \\
(c) /*
(d) */
Question 06
Which symbol is used to start a multi-line comment?
(a) //
(b) \\
(c) /*
(d) */
Question 07
Which symbol is used to end a multi-line comment?
(a) //
(b) \\
(c) /*
(d) */
Question 08
What is the output of this program? (a)
public class Java0202
{
public static void main(String args[])
{
System.out.println("Line 1");
System.out.println("Line 2");
System.out.println("Line 3");
}
}
Line 1
Line 2
Line 3
(b)
Line 1
Line 3
(c)
Line 1Line 2Line 3
(d)
Line 1Line2
Line3
(e)
Compile Errors
Question 09
What is the output of this program? (a)
public class Java0203
{
public static void main(String args[])
{
System.out.print("Line 1");
System.out.print("Line 2");
System.out.print("Line 3");
}
}
Line 1
Line 2
Line 3
(b)
Line 1
Line 3
(c)
Line 1Line 2Line 3
(d)
Line 1Line2
Line3
(e)
Compile Errors
Question 10
What is the output of this program? (a)
public class Java0204
{
public static void main(String args[])
{
System.out.println("Line 1");
System.out.println( );
System.out.println("Line 3");
}
}
Line 1
Line 2
Line 3
(b)
Line 1
Line 3
(c)
Line 1Line 2Line 3
(d)
Line 1Line2
Line3
(e)
Compile Errors
Question 11
What is the output of this program? (a)
public class Java0205
{
public static void main(String args[])
{
System.out.println("Line 1")
System.out.println("Line 2")
System.out.println("Line 3")
}
}
Line 1
Line 2
Line 3
(b)
Line 1
Line 3
(c)
Line 1Line 2Line 3
(d)
Line 1Line2
Line3
(e)
Compile Errors
Question 12
What is the output of this program? (a)
public class Java0206
{
public static void main(String args[])
{
System.out.print("Line 1");
System.out.println("Line 2");
System.out.println("Line 3");
}
}
Line 1
Line 2
Line 3
(b)
Line 1
Line 3
(c)
Line 1Line 2Line 3
(d)
Line 1Line2
Line3
(e)
Compile Errors
Question 13
What is the output of this program? (a)
public class Java0207
{
public static void main(String args[])
{
System.out.println("Line 1");
//
System.out.println("Line 2");
System.out.println("Line 3");
System.out.println("Line 4");
System.out.println("Line 5");
//
System.out.println("Line 6");
System.out.println("Line 7");
}
}
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
(c)
Line 2
Line 6
(b)
Line 1
Line 3
Line 4
Line 5
Line 7
(d)
Line 1
Line 2
Line 6
Line 7
(e) Compile Errors
Question 14
What is the output of this program? (a)
public class Java0208
{
public static void main(String args[])
{
System.out.println("Line 1");
System.out.println("Line 2");
/* System.out.println("Line 3");
System.out.println("Line 4");
System.out.println("Line 5"); */
System.out.println("Line 6");
System.out.println("Line 7");
}
}
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
(c)
Line 2
Line 6
(b)
Line 1
Line 3
Line 4
Line 5
Line 7
(d)
Line 1
Line 2
Line 6
Line 7
(e) Compile Errors
Question 15
What is the output of this program? (a)
public class Java0209
{
public static void main(String args[])
{
//
System.out.println("Line 1");
System.out.println("Line 2");
/* System.out.println("Line 3");
System.out.println("Line 4");
System.out.println("Line 5"); */
System.out.println("Line 6");
//
System.out.println("Line 7");
}
}
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
(c)
Line 2
Line 6
(b)
Line 1
Line 3
Line 4
Line 5
Line 7
(d)
Line 1
Line 2
Line 6
Line 7
(e) Compile Errors
Question 16
In order to compile, what name
must this program have?
public class Java0206
{
public static void main(String args[])
{
System.out.print("Line 1");
System.out.println("Line 2");
System.out.println("Line 3");
}
}
(a)
Java0206.java
(b)
Java0206.html
(c)
Java0206.exe
(d)
Any file that ends
with .java
(e)
Any file name.
The file name does
not matter.
Question 17
Java source code files end with
(a) .class
(b) .exe
(c) .html
(d) .java
(e) .rbt
Question 18
Java bytecode files end with
(a) .class
(b) .exe
(c) .html
(d) .java
(e) .rbt
Question 19
Which of the following icons will only compile
a Java program?
(a)
(b)
(c)
(d) (e)
Question 20
Which of the following icons will execute a Java
program?
(a)
(b)
(c)
(d) (e)
Question 21
What is the “Number 1 source of grief” for many
students when it comes to computers?
(a) Physical damage to the computer
(b) Loss of data
(c) Loss of equipment
(d) AVR
Question 22
Which of the following describes computer viruses?
(a) Malicious programs
(b) Programs that copy themselves to other
computers
(c) Programs that have been used in warfare to
disable enemy computers
(d) All of the above
Question 23
From a legal and ethical standpoint, copying
copyrighted software is considered
(a) stealing – as in felony theft.
(b) no big deal.
Question 24
Even if your computer has the best security, which
of the following will leave your computer vulnerable?
(a) Changing your password often
(b) Leaving your computer unattended
(c) Saving often
(d) Frequently backing up your files
Question 25
If you are foolish enough to make an unethical choice
when using a computer, what can happen to you?
(a) You can be charged with a felony.
(b) You may never be able to get a decent job because
you have a felony on your record.
(c) You will not be able to take care of your family
because you cannot get a decent job.
(d) You will never be able to vote or adopt children.
(e) All of the above
Extra Credit
Which of the following statements is false?
(a) Simply attempting to hack into another computer
or network is a misdemeanor.
(b) If you successfully hack into another computer or
network, you have already committed a felony,
even if you do not do anything else.
(c) Companies are reluctant to prosecute minors.
(d) Some hackers who think they are “just visiting” do
not even realize that viruses are being released
by the hacking software they downloaded.