Shared Flashcard Set

Details

CS 12B MT 1
CS 12B MT 1
28
Computer Science
Undergraduate 2
02/01/2011

Additional Computer Science Flashcards

 


 

Cards

Term
Print an error to stdout.
Definition
err.printf();
Term
Exit with status n.
Definition
exit(n);
Term
Get input from stdin.
Definition
Scanner scan = new Scanner(in);
Term
Get input from file.
Definition
Scanner scan = new Scanner(new File(filename));
Term
Test if input has next line.
Definition
scan.hasNextLine();
Term
Test if input has next word.
Definition
scan.hasNext();
Term
Access next word.
Definition
scan.next();
Term
Access next line.
Definition
scan.nextLine();
Term
Test if line matches regex.
Definition
string.matches("regex");
Term
Split line by regex.
Definition
string.split("regex");
Term
Append to the end of a queue.
Definition
void append(int val){ node temp = new node(); temp.value = val; if(tail == null) head = temp; else tail.link = temp; tail = temp; }
Term
Compare two strings lexicographically.
Definition
string.compareTo(anotherString); // negative if anotherString comes before string, zero if same, positive if anotherString comes after string.
Term
Compare two strings for equality.
Definition
string.equals(string); // returns 0/1.
Term
Algorithm is O(log_2 n). If a data structure conaints 1000000 items, approximately how many iterations will be required?
Definition
20. (log_2 1000000 = 20)
Term
A class queue has an inner class node. How does a Makefile refer to the inner class?
Definition
queue\$$node.class
Term
After a jar file is created, what command turns on the x bit?
Definition
chmod
Term
When a program terminates successfully, what exit status should it return to the caller?
Definition
0
Term
Given some files, what command will print out all of the lines in these files that match a particular regular expression?
Definition
grep
Term
If the numbers 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10 are inserted into a queue in that specific order, then we remove 5 numbers from the queue, wha tnumber will now be at the front of the queue?
Definition
6
Term
What character encoding is used by the class String in Java?
Definition
Unicode
Term
What is the big-O time efficiency of the recursive Fibonacci function?
Definition
O(n log_2 n)
Term
After discovering that fopen failed to open a file, what expression is used to print an error message?
Definition
strerror(errno)
Term
What wildcard dependency in a Makefile would precede the command javac $<
Definition
%.class : %.java
Term
What string is passed into getopt(3c) to indicate that -a is an option with no argument, but that -e is an option that requires an argument?
Definition
ae:
Term
What statement indicates program failure to the calling process?
Definition
System.exit(1);
Term
What command will search all of the Java files in the current directory and print out every line containing the word auxlib?
Definition
grep auxlib *.java
Term
If we write a loop to compute the nth Fibonacci number, how long should it run?
Definition
O(n)
Term
When opening a Scanner to read a file whose name is given, what exception must be caught?
Definition
IOException
Supporting users have an ad free experience!