ISM 3230 Ch 1
We hope you never have to encounter anything like the following expression in a program, but consider it for a moment and indicate its value: ( /* 5 + 3 */ - 9 + 6/*8*//2 ) //*+4*/ -10
-6
A comment starts with what characters?
/* Solution given that was supposedly incorrect: *// OR */\*
Which of the following lines does NOT consist of (a) valid, though boastful, comment(s)?
/* This is a //*// First Rate Program //*//
Write a complete program whose class name is Hello and that displays Hello, world on the screen.
1) public class Hello{ 2) public static void main(String[] a){ 3) System.out.println("Hello, world"); 4) } 5) } public class Hello{ public static void main(String[] a){ System.out.println("Hello, world"); } }
Write a complete main method that prints Hello, world to the screen.
1) public static void main(String[] s) { 2) System.out.print("Hello, world"); 3) System.out.println(); 4) }
Suppose your name was George Gershwin. Write a complete main method that would print your last name, followed by a comma, followed by a space and your first name.
1) public static void main(String[] s) { 2) System.out.println("Gershwin, George"); 3) } public static void main(String[] s) { System.out.println("Gershwin, George"); }
3K means about 3 thousand bytes. How would you express two hundred million bytes?
200 MB (Megabytes)
3K means about 3 thousand bytes. How would you express four trillion bytes?
4 TB (Terabytes)
3K means about 3 thousand bytes. How would you express five billion bytes?
5 GB (Gigabytes)
In modern computer systems, a byte consists of
8 bits
When a program runs on a computer, the part of the computer that carries out the instructions is called the
CPU OR central processing unit OR ALU OR arithmetic and logic unit
Which of these is not a programming language? C C++ HTML Java
HTML
What best defines a "programming language"?
It allows us to express an algorithm.
Which statement is NOT true: Machine languages can be used to express algorithms. Machine languages can be used to write programs that can run on any machine. Machine language consists of zeros and ones. Machine language is produced by compilers.
Machine languages can be used to write programs that can run on any machine.
Write a statement that prints Hello, world to the screen.
System.out.println("Hello, world");
Suppose your name was Alan Turing. Write a statement that would print your last name, followed by a comma, followed by a space and your first name.
System.out.println("Turing, Alan");
A bit is
a binary digit, like 0 or 1.
A binary digit is
a zero or one
A byte in memory is identified by a unique number called its
address
An operating system: is the chief hardware unit in a computer. is loaded into the computer each time it needs to carry out an operation. ensures that programs will not run on the computer at the same time. allocates resources like memory to programs that are running. all of the above.
allocates resources like memory to programs that are running.
At each step of its operation, the input to a Central Processing Unit is
an instruction
The text of a comment
can be anything the programmer wants to write.
The text of a comment: is checked by the compiler for accuracy. must appear in the first line of the program. is printed out when the program runs. can be anything the programmer wants to write.
can be anything the programmer wants to write.
Which of the following lines contains a valid, though not necessarily accurate, comment?
int twoPi = 3.14159; /* holds the value of two times pi */
Which comment below is the most helpful? int volume; // declare an int int volume; // declare volume int volume; // declare volume to be an int variable int volume; // size of trunk in cubic feet
int volume; // size of trunk in cubic feet
To run a Java program from a command line, we use the__________ command.
java
Files containing Java code must end with what "extension"?
java or .java
The standard name of the Java compiler is
javac
When a program runs on a computer, it is stored in
main memory OR memory OR RAM OR primary memory
When a program is not running, it is stored
on a disk.
Monitors, printers, status lights are all examples of
output devices
Rearrange the following code so that it forms a correct program that prints out the letter Q: } public static void main(String[] a) { } System.out.println("Q"); public class Q {
public class Q { public static void main(String[] a) { System.out.println("Q"); } }
Flash drives, CDs, external disks are all examples of
secondary OR auxiliary OR external OR nonvolatile storage (memory) devices.
The code that a programmer writes is called
source code
The rules that govern the correct order and usage of the elements of a language are called the _____________ of the language
syntax OR grammar
A compiler
translates source code into executable code
RAM, random-access memory, is called that because
you can pick any two random locations and it will take the same time to access the data.