click below
click below
Normal Size Small Size show me how
OOP LEC [FA5]
CS0070
| Question | Answer |
|---|---|
| Which of the following is not true for the UnsupportedOperationException? | It occurs if a method is not found in the underlying collection. |
| Which of the following is a correct difference between ArrayList and LinkedList? | ArrayList uses a dynamic array whereas the LinkedList uses doubly linked lis |
| What type of variables can we use with the java.util.Collections Class? | reference variables |
| What type of variables can we use with the java.util.Arrays class? Group of answer choices both primitive variables neither reference variables | both |
| Which of these interface is not a part of Java's collection framework? Group of answer choices Set SortedList List SortedMap | SortedList |
| Which of the following is not true in case of a WeakHashMap? | WeakHashMap doesn't allow null keys and null values. |
| Which of the following is not true for a generic collection | Generic collection is not mutable. |
| What type of ordering does a PriorityQueue have? Group of answer choices ordered and unsorted unordered and unsorted ordered and sorted | ordered and sorted |
| Which of the following class doesn't implement the Set interface? Group of answer choices LinkedHashSet HashSet TreeSet None of the above | None of the above |
| A PriorityQueue is always sorted in natural order? Group of answer choices false true | false |
| This the standard input stream. Group of answer choices System.out System.in System.err | System.in |
| The java.util.io package contains all the classes required for input and output operations. Group of answer choices true false | false |
| In Java, 3 streams are created for us automatically. Group of answer choices false true | True |
| A stream is composed of bits Group of answer choices false true | false |
| Java In/Ou is used to process the input and produce the output. | false |
| Java ReadFile class returns data in byte format like FileInputStream class. | false |
| Java ReadFile class is used to read data from the file. Group of answer choices true false | false |
| A constructor of the FileReader class that creates a new file and get its file name in string Group of answer choices FileReader (String file) FileReader (Character file) FileReader (File file) FileReader (Byte file) | FileReader (String file) |
| write (char c) is a method of the FileWriter class that is used to write the char into FileWriter. Group of answer choices true false | True |
| Can we have a sorted and unordered map? Group of answer choices Yes No | No |
| When would you choose to use ArrayList over LinkedList in an application? | ArrayList is preferred when there is more demand for get via index operations. |
| What type of variables can we use with the java.util.Arrays class? Group of answer choices both reference variables neither primitive variables | both |
| Which type of list implements the Queue interface Group of answer choices ArrayList LinkedList Vector | LinkedList |
| Which method do we need to implement in the java.util.Comparator interface? Group of answer choices sort() compareTo() sortTo() compare() | compare() |
| What type of collection does not extend the Collection interface? Group of answer choices Map Queue Set List | Map |
| Which of the following is a valid difference between Set and Map? | Set contains only values whereas Map contains key and values both. |
| Can we have a sorted and unordered set? Group of answer choices No Yes | No |
| Which of the following is not true for a fail-fast iterator? | Fail fast system reports the failure right away but the system recovers after the failure. |
| Which of the following is not true for a generic collection? Group of answer choices Generic collection doesn't require typecasting. None Generic collection is typesafe and checked at compile time. Generic collection is not mutable. | Generic collection is not mutable. |
| System.err is the standard error stream. Group of answer choices false true | True |
| A stream is a sequence of data. Group of answer choices true false | True |
| Java In/Ou is used to process the input and produce the output. Group of answer choices false true | False |
| InputStream is used to read data from a source; it may be a file, an array, peripheral device or socket. Group of answer choices true false | True |
| InputString is used to read data from a source; it may be a file, an array, peripheral device or socket. Group of answer choices true false | False |
| What are the valid Constructors of FileWriter class? (choose two) Group of answer choices FileWriter(Byte file) FileWriter(Character file) FileWriter(File file) FileWriter(String file) | FileWriter(File file) FileWriter(String file) |
| A method of the FileReader class that is used to return a character in ASCII form. It returns -1 at the end of file. Group of answer choices input () get () scan () read () | read () |
| flush () is a method of the FileWriter class that is used to close the FileWriter. Group of answer choices false true | False |
| In using __________, unlike FileOutputStream class, you don't need to convert string into byte array because it provides method to write string directly. | FileWriter Class |
| Which of these packages contain all the collection classes? Group of answer choices java.net java.util java.awt java.lang | java.util |
| Which of these interface declares core method that all collections will have? Group of answer choices Comparator Collection EventListner set | Collection |
| What is Collection in Java? Group of answer choices A group of classes None of the mentioned A group of interfaces A group of objects | A group of objects |
| Can we have a sorted and unordered map? Group of answer choices Yes No | No |
| Within a PriorityQueue the elements sorted last are processed first? Group of answer choices true false | False |
| Which of the following is a correct difference between HashSet and TreeSet? | HashSet maintains no order while TreeSet maintains ascending order. |
| The __________method of OutputStream Class is used to write an array of byte to the current output stream. | write(byte[]) |
| Automatically created streams are attached with the console. Group of answer choices true false | True |
| A string is a sequence of data. | False |
| System.util.Scanner is the standard input stream. | False |
| Java ReadFile class is used to read data from the file. | False |
| scan () is a method of the FileReader class that is used to return a character in ASCII form. It returns -1 at the end of file. | False |
| WriterFile(File file) is a constructor of the Filewriter class that creates a new file and get its file name in file objects. Group of answer choices false true | False |
| Which interface would we use to sort a class that can't be modified? Group of answer choices java.lang.Comparable java.util.Comparator | java.util.Comparator |
| What type of exception is raised when we try run a program with objects that are not mutually comparable in a sorted map? Group of answer choices OutOfBoundsException None RuntimeException ClassCastException | ClassCastException |
| There are no direct implementation of the Collection interface? | True |
| What is returned from both the compare() and compareTo() methods? Group of answer choices char int boolean string | int |
| Is the following code snippet valid? public class SimpleGenericInterfaceImpl implements SimpleGenericInterface { ? Group of answer choices no yes | yes (technically no) |
| What type of collection would we use if we wanted no duplicates? Group of answer choices Set List Queue Map | Set |
| Which of the following is a correct difference between List and Set? | List can hold duplicate elements while Set includes only unique elements. |
| What is the correct difference between HashSet and HashMap? | HashSet contains only values whereas HashMap contains the key and value pair. |
| What type of set would you use if you wanted it sorted? Group of answer choices HashSet TreeSet LinkedHashSet | TreeSet |
| All are invalid codes in getting an input from the console, except one. Group of answer choices i=System.in.read(); i=System.in.readf("%i",123); i=System.in.read=123; i=System.in.readln(123); | i=System.in.read(); |
| The display(int) method of OutputStream Class is used to write a byte to the current output stream. Group of answer choices true false | False, write(int b) or write(byte[] b) |
| System.out is the standard output stream | True |
| A method of the FileWriter class that is used to write the string into FileWriter. Group of answer choices inscribe (String text) engrave (String text) write (String text) create (String text) | write (String text) |
| create (char c) is a method of the FileWriter class that is used to write the char into FileWriter. | False |
| A method of the FileWriter class that is used to write the char into FileWriter. | write (char c) |
| Where are enforced database conditions in an integrity control security feature? | Assertions |
| What is the syntax of creating a view? | CREATE OR REPLACE VIEW AS SUBQUERY VIEWNAME |
| What is a security feature is database that sets domains, assertions and triggers to protect from unauthorized use? | integrity controls |
| Every PL/SQL variables has a data type, which specifies a storage format, constraints, and a valid range of values. | True |
| When altering or modifying a sequence, the previous sequences are also affected | False |
| Which among the following is going to create a view that would show average of a single column, given that the column’s data type is a number? | CREATE OR REPLACE VIEW MYAVEVIEW AS SELECT AVG(SALARY) FROM EMPLOYEES; |
| A simple view contains group of data | False |
| Can a simple view contain groups of data? | No |
| Given the following code: CREATE VIEW CHEAPTHINGS AS SELECT PRODID, PRODTITLE, PRODPRICE FROM PRODUCT WHERE PRODPRICE<300 WITH CHECK OPTION; What is the purpose of the clause WITH CHECK OPTION? | It will work only for updateable views and prevents updates that would create rows not included in the view. |
| These are building blocks of any PL/SQL block. | LEXICAL UNITS |
| It is a table containing the raw table | Base Table* |
| Given the SQL statement: Create view View1 (id,name) as select employee_id, last_name from employees where department_id = 90; , what will the statement do? | it creates a view called view1 with 2 columns |
| It provides users controlled access to tables. | Views |
| What format does Oracle server generates when the constraint wasn’t named? | |
| It is a framework that provides an architecture to store and manipulate the group of objects | Collection |
| LinkedHashSet class contains unique elements | True |
| Java___________ class implements the Set interface that uses a tree for storage. | TreeSet |
| The iterable interface is the root interface for all the collection classes. | True |
| Which of the following is a correct difference between ArrayList and Vector? - None - ArrayList is not a legacy class while Vector is the legacy. - ArrayList increases its size by doubling the array size while Vector increases by 50% of the array size. | ArrayList is not a legacy class while Vector is the legacy |
| ArrayDeque is faster than ArrayList and Stack and has no capacity restrictions | True |
| LinkedList Collection uses a doubly LinkedList internally to store the elements. It can store the duplicate elements. It maintains the insertion order and is not synchronized. | True |
| Which of these is true about unmodifiableCollection() method? Group of answer choices unmodifiableCollection() returns a collection that cannot be modified none of the mentioned unmodifiableCollection() method is available only for List and Set | unmodifiableCollection() returns a collection that cannot be modified |
| HashLinkedSet class extends the HashSet class and implements Set interface | False |