CSCI 1301 EXAM REVIEW
-
Upload
bri-jackson -
Category
Documents
-
view
230 -
download
0
Transcript of CSCI 1301 EXAM REVIEW
-
8/9/2019 CSCI 1301 EXAM REVIEW
1/45
Review Exam 1
CSCI – 1301 - 120
-
8/9/2019 CSCI 1301 EXAM REVIEW
2/45
• Consider the following pseudoode! what doesit produe" – Set n # 0$
– Set a # 0$
– Set & # 1$
– Set p # 1$
– 'rint p$
– Repeat until n e(uals 10
– Set p # a ) &$
– Set a # &$
– Set & # p$
– *dd 1 to n$
– 'rint p$
-
8/9/2019 CSCI 1301 EXAM REVIEW
3/45
• +he language developed &, Sun
iros,stems that &eame the .avaprogramming language was originall,designed to &e simple! seure!and////////
• a eas, to use in an, language
• & availa&le over the Internet
• usa&le for man, dierent proessort,pes
• d environmentall, friendl,! or green
-
8/9/2019 CSCI 1301 EXAM REVIEW
4/45
• .ava is said to &e a safe programminglanguage$ hat does this mean"
• a .ava programs annot auseenvironmental damage &eause the, aregreen$
• & .ava programs an run within a &rowserwithout fear that the, ma, atta4 ,ouromputer$
• +here is no wa, for a .ava program to reador write a 5le$
• d .ava programs annot aess data arossa omputer networ4
-
8/9/2019 CSCI 1301 EXAM REVIEW
5/45
• In order for .ava to ahieve porta&ilit,
• a ompiled .ava programs ontaininstrutions for a virtual mahine
• & .ava is not ompiled• .ava programs must &e re-ompiled
on eah platform where the, are to
run• d .ava programs are &ased on the C)
) programming language
-
8/9/2019 CSCI 1301 EXAM REVIEW
6/45
• * .ava 6irtual ahine is
• a * theoretial mahine to helpunderstand the omputational omplexit,of algorithms
•
& * program that simulates a real C'7• * 4ind of omputer hardware that is
em&edded into the C'7s of all omputersusing .ava
• d * li&rar, pa4age that extends theapa&ilit, of the .ava programminglanguage
-
8/9/2019 CSCI 1301 EXAM REVIEW
7/45
• +he .ava programming language isitself relativel, simple! &ut also
ontains a vast set of ////////
• a s,ntatial variations
• & program templates
• ross-platform sripting languages
• d li&rar, pa4ages
-
8/9/2019 CSCI 1301 EXAM REVIEW
8/45
• +he soure ode for a .ava programis stored in a 5le
• a that ends with a $lass su8x
• & that an have an, valid 5le name
• that ends with a $9ava su8x
• d that has no su8x
-
8/9/2019 CSCI 1301 EXAM REVIEW
9/45
• * .ava lass 5le
• a ontains .ava soure ode
• & ontains instrutions to the .avavirtual mahine
• is an internal 5le reated &, theIntegrated :evelopmentEnvironment ;I:E
• d is the translation of the .avasoure ode into C))
-
8/9/2019 CSCI 1301 EXAM REVIEW
10/45
• In .ava! the statementSystem.out.print("hello");;<
• a is a s,ntax error
• & is a legal statement
• seems li4e it should print outhello &ut doesn=t
• d as4s the user to enter a value andstores it in the varia&le hello
-
8/9/2019 CSCI 1301 EXAM REVIEW
11/45
• * se(uene of steps that isunam&iguous! exeuta&le! and
terminating is alled
• a pseudoode
• & an algorithm
• a logarithm
• d a programming tas4
-
8/9/2019 CSCI 1301 EXAM REVIEW
12/45
• hih of the following optionsdelares a >oat varia&le"
• a Float age;
• b) flt age;
• c) float age;
• d) age: float;
-
8/9/2019 CSCI 1301 EXAM REVIEW
13/45
hat is the result of the following odesnippet"
public static void main(String[] args){
double circleRadius;
double circleVolume;
circleVolume = 22 / 7 * circleRadius * circleRadius;
System.out.println(circleVolume);
}
• a 0
•
& 3$1?• @$2A
• d ompile-time error
-
8/9/2019 CSCI 1301 EXAM REVIEW
14/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
15/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
16/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
17/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
18/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
19/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
20/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
21/45
What is the result of the following statement?
String s = "You" + "had" + "me" + "at" + "hello";
a) The string s has the following value: "You had me at hello" b) The statement results in an error because the + operator can be used onlywith numbers
c) The statement results in an error because the + operation cannot beperformed on string literals
d) The string shas the following value: "Youhadmeathello"
-
8/9/2019 CSCI 1301 EXAM REVIEW
22/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
23/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
24/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
25/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
26/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
27/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
28/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
29/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
30/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
31/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
32/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
33/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
34/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
35/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
36/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
37/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
38/45
+he >ow hart shows the order in whihsteps should &e exeuted! and the diamond-
shaped &oxes indiate a input& algorithms tas4s
d onditional tests
-
8/9/2019 CSCI 1301 EXAM REVIEW
39/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
40/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
41/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
42/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
43/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
44/45
-
8/9/2019 CSCI 1301 EXAM REVIEW
45/45
BRID F7R BFFG
for the examF E:ES:*
H1J012