COP3330: exam 2 Actual Updated Questions And Answers, Exams of Medicine

COP3330: exam 2 Actual Updated Questions And Answers

Typology: Exams

2025/2026

Available from 01/09/2026

Ted.Bright
Ted.Bright 🇺🇸

5

(1)

7.3K documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COP3330: exam 2 Actual Updated Questions And Answers
1.
Which method is using to add a value to the beginning
addFirst()
of a LinkedList? (inlcude parentheses)
2.
Which method do you use to add a value to the end of
addLast()
a LinkedList? (inlcude parentheses)
3.
Which method removes the head value of a c
LinkedList?
a.
pop()
b.
cut()
c.
remove()
d.
erase()
4.
What does the method trim() do to this sentence: "The
b
cat jumps on the counter."
a.
removes punctuation characters
b.
removes whitespace
c.
removes the first and last words
d.
nothing
5.
What does the method substring(7, 12) produce from
this sentence: "Hello, World!"?
6.
The methods toUpperCase() and toLowerCase() make
the first letter of each word in a sentence change only.
true/false
7.
What is the error(s) in creating an object for this file?
File myFile = File(filename.txt);
a.
File must be lower case
b.
new must be after the equal sign
World
false
d
pf3
pf4
pf5

Partial preview of the text

Download COP3330: exam 2 Actual Updated Questions And Answers and more Exams Medicine in PDF only on Docsity!

COP3330: exam 2 Actual Updated Questions And Answers

  1. Which method is using to add a value to the beginning addFirst() of a LinkedList? (inlcude parentheses)
  2. Which method do you use to add a value to the end of addLast() a LinkedList? (inlcude parentheses)
  3. Which method removes the head value of a c LinkedList? a. pop() b. cut() c. remove() d. erase()
  4. What does the method trim() do to this sentence: "The b cat jumps on the counter." a. removes punctuation characters b. removes whitespace c. removes the first and last words d. nothing
  5. What does the method substring(7, 12) produce from this sentence: "Hello, World!"?
  6. The methods toUpperCase() and toLowerCase() make the first letter of each word in a sentence change only. true/false
  7. What is the error(s) in creating an object for this file? File myFile = File(filename.txt); a. File must be lower case b. new must be after the equal sign World false d

c. filename must be in quotations d. b and c

  1. What is the result at the end of the code? String result = " Java Quiz "; result = result.trim(); result = result.substring(2, 6); result = result.toUpperCase();
  2. What is list at the end of the code? list.add(1); list.add(2); list.add(5); list.add(10); list.add(15); list.addFirst(100); list.remove(2); list.addLast(20);
  3. What will be the output of the following Stack opera- tions? public class Main { public static void main(String[] args) { Stack stack = new Stack<>(); stack.push("A"); stack.push("B"); stack.push("C"); stack.pop(); stack.push("D"); System.out.println(stack.peek()); } }

VA Q

D

  1. What is the output of the following Java program? 30

f. remove g. addFirst h. removeLast

  1. What is the output of the following Queue operations? 10 public class Main { public static void main(String[] args) { Queue queue = new LinkedList<>(); queue.add(5); queue.add(10); queue.add(15); queue.poll(); System.out.println(queue.peek()); } }
  2. How would you create a LinkedList called intList with an integer? (spaces where needed and semicolon)
  3. How would you add the number 14 to a LinkedList called intList? (remember semicolon)
  4. How would you clear all elements from a LinkedList called intList? (remember semicolon)
  5. How would you clone a LinkedList called intList? (re- member semicolon)
  6. How would you retrieve the first element of a LinkedList called intList without removing it? (remem- ber semicolon, use println) LinkedList intList = new LinkedList<>(); intList.add(14); intList.clear(); intList.clone(); System.out.print- ln(intList.peek());
  7. System.out.print- ln(intList.poll());

How would you retrieve and remove the first element of a LinkedList called intList? (remember semicolon, use println)

  1. How would you remove and return the first element of System.out.print- a LinkedList called intList? (remember semicolon, use println)
  2. How would you return the number of elements in a LinkedList called intList? (remember semicolon, use println)
  3. How would you convert a LinkedList called intList into ln(intList.pop()); System.out.print- ln(intList.size()); Object[] arr = intList.toAr- an array by creating an object? (remember semicolon) ray();
  4. How would you return the index character "F" in the string as a char called ch: String str = "Red Fox";
  5. The method compareTo() compares two strings lexi- cographically; returning a zero if equal and postive or negative. true/false
  6. The method endsWith() checks if a string ends with a vowel or consinant and returns a boolean value. true/false
  7. Make an object called isEqual that would return true, using a .equals() method with this string: word = "UCF" char ch = str.charAt(4); true false boolean isEqual = word.equals("UCF");