201 Final

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following is not one of the three stages of testing that a commercial software will go through? Development Testing Release Testing User Testing Iterative Testing

Iterative Testing

Which of the following is not one of the three stages of testing that a commercial software will go through? User Testing Development Testing Iterative Testing Release Testing

Iterative Testing

Which of the following is true about Java inheritance? Java supports single and multiple inheritance. Java supports single inheritance. Java does not support inheritance. Java supports multiple inheritance

Java supports single inheritance.

interface Parent { public int meth1(); } abstract class Child implements Parent { public abstract int meth2(); public int meth1() ; public bool meth3(){ return true; } } class GrandChild extends Child { public int meth2() { return 30; } } What is wrong with the above code? Meth2() in Child is declared abstract. Meth3() in Child is not declared abstract. Meth1() in Grandchild is not implemented. Meth1() in Child is not declared abstract.

Meth1() in Grandchild is not implemented.

Which of the following SQL statements creates this table? (NULL NULL NULL)

NOT NULL, NOT NULL, DOUBLE, VARCHAR(500), INT(11) Parentheses are used to designate the columns of a table in a CREATE statement. The type of the field comes after the name of the field.

Which of the following statements regarding interfaces is correct? An interface contains method implementations. A class can only implement a single interface. Both Option #1 and #2. Neither Option #1 nor #2.

Neither Option #1 nor #2.

Which of the following statements regarding interfaces is correct? 1. An interface contains method implementations. 2. A class can only implement a single interface. 3. Both Option #1 and Option #2. 4. Neither Option #1 nor Option #2.

Neither Option #1 nor Option #2.

Is it possible for a thread to be in two states at the same time?

No

Can you invoke the garbage collector to run immediately? Yes, by calling delete() Yes, by calling System.gc() No, we can make suggestions to the JVM to run it as soon as possible by calling System.gc() Java does not have garbage collector

No, we can make suggestions to the JVM to run it as soon as possible by calling System.gc()

How to select a html element with ID called top in CSS?

#top{ }

Assume your program is running from the directory /usr/java/programs/. If you want to read the file /usr/input.txt, all of the following paths would work except .././input.txt ../../input.txt /usr/input.txt /usr/java/../input.txt

.././input.txt

Which one presents the correct ways for creating CSS selectors? classname, #idname, .tagname #classname, .idname, tagname .classname, idname, #tagname .classname, #idname, tagname

.classname, #idname, tagname

The following function prevents deadlock by signaling to whoever is waiting: .sleep() .await() .notify() .wait()

.notify()

The following function prevents deadlock by signaling to whoever is waiting: .sleep() .wait() .await() .notify()

.notify()

Can you invoke the garbage collector to run immediately? Yes, by calling delete() Yes, by calling System.gc() Java does not have a garbage collector No, we can make suggestions to the JVM to run it as soon as possible by calling System.gc()

No, we can make suggestions to the JVM to run it as soon as possible by calling System.gc()

Where are files stored in a computer system? Main memory Non-volatile memory Volatile memory Cache

Non-volatile memory

Where are files stored in a computer system? Non-volatile memory Cache Main memory Volatile memory

Non-volatile memory

Which of the following is true about JSPs and HTML files? JSPs does not allow for Java to be embedded in the file. JSPs do not get converted to servlets None of above To declare an element in you start with ! inside < brackets

None of above

Does parallelizing code always mean faster execution? Not always No Yes Java does not offer parallel programming

Not always

Which of the following is NOT true about semaphores? A thread can release permits on a semaphore even without having them. Semaphores can restrict the number of threads that access a shared resource. The number of permits available on a semaphore is specified at creation. Only one permit is available on a semaphore

Only one permit is available on a semaphore

Which of the following is NOT true about semaphores? Semaphores can restrict the number of threads that access a shared resource. Only one permit is available on a semaphore. The number of permits available on a semaphore is specified at creation. A thread can release permits on a semaphore even without having them.

Only one permit is available on a semaphore.

How many 32 bit IPv4 addresses are there? Unlimited One billion Over four billion 10 billion

Over four billion

How would we create a socket connecting to port 6789 of the loopback address? Socket s = new Socket("loopback", 6789); Socket s = new Socket(6789, "localhost"); Socket s = new Socket("127.0.0.1", 6789); Socket s = new Socket(6789, "127.0.0.1");

Socket s = new Socket("127.0.0.1", 6789);

Which thread method do you call if you want to begin a thread's execution? Yield Run Sleep Start

Start

Which thread method do you call if you want to begin a thread's execution? Yield Sleep Run Start

Start

Which of the following is/are provided by a Relational Database Management System? Security Structure Design All of the above

Structure

Which of the following is not a valid state for a thread? Waiting Switching Ready Sleeping

Switching

Which of the following statements about the code is correct? tb waits for ta to finish before it continues executing. No thread waits for any other thread. ta waits for tb and tc to finish before it continues executing. The main thread waits for ta, tb, and tc to finish before it continues executing.

The main thread waits for ta, tb, and tc to finish before it continues executing.

In the producer/consumer problem with multiple producers and locks and conditions, why are some data members and methods static? The static keyword prevents more than one instance of a producer/consumer from modifying data at the same time The static keyword defines shared resources amongst every instance of a class The static keyword makes the chosen data members thread safe None of the above

The static keyword defines shared resources amongst every instance of a class

In the Producer/Consumer problem with multiple producers (like Sleeping Barber) with locks and conditions, why are some data members/methods static? The static keyword prevents more than one instance of a producer/consumer from modifying data at the same time. The static keyword defines shared resources amongst every instance of a class. The static keyword makes the chosen data members thread-safe. None of the above

The static keyword defines shared resources amongst every instance of a class.

What happens if a thread calls await() and doesn't receive a signal? After a set amount of time, which is passed as a parameter in the await() function, the thread moves out of the waiting state. The thread remains in the waiting state forever. The JVM moves the thread out of the waiting state after a predetermined amount of time. None of the above.

The thread remains in the waiting state forever.

What happens if a thread calls await() and doesn't receive a signal? After a set amount of time, which is passed as a parameter in the await() function, the thread moves out of the waiting state. The thread remains in the waiting state forever. The JVM moves the thread out of the waiting state after a predetermined amount of time. None of the above.

The thread remains in the waiting state forever.

Which of the following is not a purpose/function of java servlets? They allow front end code to make GET requests to java. They allow you to output HTML code as a response to a request. They allow you to run different code depending on whether the request was a GET or POST request They are embedded in HTML and sent to the front end.

They are embedded in HTML and sent to the front end.

Which of the following is not a purpose/function of java servlets? They allow front end code to make GET requests to java. They allow you to output HTML code as a response to a request. They allow to you run different code depending on whether the request was a GET request or a POST request. They are embedded in HTML and sent to the front end.

They are embedded in HTML and sent to the front end. Servlets are the Java programs that runs on the backend server. They are not sent to the front end.

Which of the following do relational database management systems NOT provide? 1. Representation of data 2. Means for accessing data 3. Transportation of data 4. Contraints on data

3. Transportation of data

Why do we have to implement the abstract methods in the (non-abstract) child class? 1. to override the implementations in the parent class 2. So that the code can compile 3. Otherwise, there won't be any implementations for the abstract methods 4. Both 2 & 3

4. Both 2 & 3

How many heading tags are there in HTML? 3 6 10 8

6

Which of the following tags are used to embed Java in a JSP?

<% %>

Which of the following statements is NOT true about conditions? Conditions are associated with a lock. Monitors do not have conditions. A condition is created by instantiating the Condition class. To call a method on a condition, you must have the lock that is associated with it.

A condition is created by instantiating the Condition class.

Which of the following statements regarding Garbage Collection in Java is true? A memory location is a candidate for garbage collection when it no longer is referenced by any part of your program. Programmers can explicitly invoke the garbage collector by calling "System.gc()" . The programmer can explicitly free memory by calling the "free()" and "delete()" methods. None of the previous options.

A memory location is a candidate for garbage collection when it no longer is referenced by any part of your program.

Which of the following is true about subnets? A subnet mask will consist of of all 1's followed by all 0's. A subnet mask can be written as "/# of zeros". In order to achieve subnetting, we take away bits form the host in both IPv4 and IPv6. In IPv6 the subnet bits are 65-128.

A subnet mask will consist of of all 1's followed by all 0's.

What does a SELECT statement in SQL return? A table's row A string with the data A table's column A table

A table

Which line of code would you put in an expression tag (<%= %>)?

A variable name or string literal

Which line of code would you put in an expression tag (<%= %>)? page language="java" contentType="text/html; A variable name or string literal System.out.println("hello world"); String fname = request.getParameter("fname");

A variable name or string literal

Which of the following is true? A. An object with the compile-time of a parent can take on the form of a child at runtime B. if a method only exists in the child and you an instance of a parent, you can still call the method from the child Both A and B Neither A nor B

A. An object with the compile-time of a parent can take on the form of a child at runtime

Which of the following is not true about AJAX? AJAX uses XMLHttpRequest to communicate with the server. AJAX must be performed in your Java servlet. JQuery preforms the same functionality as AJAX AJAX can be performed on submission of a form by adding the onsubmit parameter in the form tag.

AJAX must be performed in your Java servlet.

What can JavaScript NOT do? Read or modify HTML elements. Communicate with the backend. Act as an implicit servlet. Modify default form submission behavior.

Act as an implicit servlet.

When is the condition on a thread checked? Before the lock is on the object. After the lock is on the object. Never When awake() is invoked.

After the lock is on the object.

In Java, when will an object become eligible for garbage collection? After the object becomes unreachable. After the delete keyword is used on the pointer that references the object. After the program terminates. After the programmer manually calls the garbage collector on the object using "Objectname.gc()"

After the object becomes unreachable.

Which of the following are true about AJAX? AJAX stands for Asynchronous JavaScript and XML. AJAX allows for just part of a page to be reloaded with direct access to the server. AJAX uses JavaScript and HTML DOM to display the data. All of the above

All

Which of the following statements regarding Web Sockets is/are correct? WebSockets provide a means for persistent two-way communication between a web browser and a web server. The constructor to the JavaScript WebSocket class takes a URI as a parameter, specifying the location of the WebSocket endpoint. In Java, the @ServerEndpoint annotation can be used to specify the name of the WebSocket endpoint. All of the above

All

How are Java objects allocated? Java gives the programmer the ability to allocate objects either dynamically or statically. All Java objects are dynamically allocated. All java objects are statically allocated. Java doesn't have objects, just primitive variable types.

All Java objects are dynamically allocated.

How are Java objects allocated? Java gives the programmer the ability to allocate objects either dynamically or statically. All Java objects are dynamically-allocated. Java doesn't have objects but just primitive variable types. All Java objects are statically-allocated.

All Java objects are dynamically-allocated.

A class is encapsulated if: All data is declared private at least one variable is declared private all data is declared public at least one variable is declared public

All data is declared private

A class is encapsulated if: All data is declared private All data is declared public At least one variable is declared public At least one variable is declared private

All data is declared private

What are some criteria of failed software projects? Project went over budget Final product is missing critical features Final product isn't functional All of the above

All of the above

What does a client application need to connect to a server application? IP address Socket Port All of the above

All of the above

What is a reason a software engineering project could be considered a failure? Not functional or buggy Missing critical features Over schedule/budget All of the above

All of the above

What is a source of failure for software engineering projects? Not functional or buggy Missing critical features. Over schedule/budget All of the above

All of the above

Which of the following are true about AJAX? AJAX stands for Asynchronous JavaScript and XML. AJAX allows for just part of a page to be reloaded with direct access to the server. AJAX uses JavaScript and HTML DOM to display the data. All of the above

All of the above

Which of the following is true about java interfaces? A class can implement as many interfaces as it wants Not all methods in an interface must be implemented for an abstract class Interfaces can extend other interfaces by using the "extends" keyword All of the above

All of the above

Which of the following is true about Java interfaces? A class can implement as many interfaces as it wants. Not all methods in an interface must be implemented for an abstract class. Interfaces can extend other interfaces by using the "extends" keyword. All of the above.

All of the above.

Which of the following is true about Java interfaces? A class can implement as many interfaces as it wants. Not all methods in an interface must be implemented for an abstract class. Interfaces can extend other interfaces by using the "extends" keyword. All of the above.

All of the above.

Which of the following statements regarding semaphores is correct? A thread can release permits on a semaphore even without having them. A thread must acquire one of the permits of the semaphore before executing code managed by a semaphore. The number of permits available on a semaphore is specified at creation. All of the above.

All of the above.

What will happen with an UPDATE statement is missing a WHERE clause? No rows will be updated The first row will be updated All rows will be updated The statement will be rejected by most SQL DBMS and no rows will be updated (except SQL *PLUS and MySQL which will update all rows)

All rows will be updated

What will happen with an UPDATE statement missing a WHERE clause? The statement will be rejected by most SQL DBMS and no rows will be updated (except SQL*PLUS and MySQL which will update all rows). The first row will be updated. All rows will be updated. No rows will be updated.

All rows will be updated.

How do prepared statements help protect against SQL injection attacks? They can check the input from users to see if it has SQL code in it, and reject it if it detects any SQL code. They convert any input received from users into a sql string, escaping any quotes to prevent the users from running their own commands. They don't protect against SQL injection attacks. They allow the programmer to create SQL queries in java without having to use string concatenation.

They convert any input received from users into a sql string, escaping any quotes to prevent the users from running their own commands.

The following are all benefits of using thread pools EXCEPT: A thread in a thread pool can be reused once it competes execution. Thread pools help avoid performance issues that can arise when creating multiple individual threads. If a thread in a thread pool terminates due to failure, another thread will be created to replace it. Thread pools run all of your threads right away.

Thread pools run all of your threads right away.

Extending Thread is a worse idea than implementing Runnable because... Thread actually cannot be extended but only implemented since it is an interface. Implementing Runnable makes it possible to let a thread start itself. Extending Thread will handicap your ability to inherit from other classes. Extending Thread results in significantly more overhead.

Extending Thread will handicap your ability to inherit from other classes.

Extending Thread is a worse idea than implementing Runnable because... Extending Thread results in significantly more overhead. Extending Thread will handicap your ability to inherit from other classes. Implementing Runnable makes it possible to let a thread start itself. Thread actually cannot be extended but only implemented since it's an interface.

Extending Thread will handicap your ability to inherit from other classes.

Why is a performance increase not guaranteed for parallel computing? Network delays cause performance bottlenecking. Modern-day CPUs have sufficient single-core performance. Forking and joining has their own overhead. Parallel computing adds functionality and does not increase performance.

Forking and joining has their own overhead.

Why is a performance increase not guaranteed for parallel computing? Network delays cause performance bottlenecking. Modern-day CPUs have sufficient single-core performance. Forking and joining has their own overhead. Parallel computing adds functionality and does not increase performance.

Forking and joining has their own overhead.

What is HTML used for? HTML is a programming language used to dynamically generate web content. HTML is a markup language used to format web content. HTML is a markup language that is able to communicate with the backend. All of the above

HTML is a markup language used to format web content.

What does HTML stand for? Hyper Text Markup Language Hypertext Transfer Markup Language Hyper Text Modeling Language None of the above

Hyper Text Markup Language

Refer to the database in Lecture 18 with tables (and variables) Class (classID, prefix, num), Student (studentID, fname, lname), Grades (gradeID, classID, studentID, letterGrade). How would we insert a new row into the Grades table? INSERT INTO Grade (gradeID, classID, studentID, letterGrade) VALUES (1, 1, 1, 'A'); INSERT INTO Grade (classID, studentID, letterGrade) VALUES (1, 1, 'A'); INSERT INTO Grade (studentID, letterGrade) VALUES (1, 'A'); INSERT INTO Grade (letterGrade) VALUES ('A');

INSERT INTO Grade (classID, studentID, letterGrade) VALUES (1, 1, 'A');

Which of the following must be handled in a try-catch block? NoClassDefFoundError IOException NullPointerException All of the above

IOException

Which of the following is NOT true regarding IP adresses: IPv4 addresses consist of 32 bits. IP address is a unique address. IP address is not required for a computer to communicate on a network. IPv6 addresses consist of 128 bits.

IP address is not required for a computer to communicate on a network.

Which of the following is NOT true regarding IP adresses: IP address is not required for a computer to communicate on a network. IPv4 addresses consist of 32 bits. IP addresses are unique addresses. IPv6 addresses consist of 128 bits.

IP address is not required for a computer to communicate on a network.

Which one of the following statements is true about Java's Serializable interface? Static and private variables of an object are not saved when an object implements the Serializable interface An object can be stored using an ObjectOutputStream and retrieved using an ObjectInputStream when the object's class implements the Serializable interface An object's state cannot be retrieved when the object's class implements the Serializable interface An object can be stored using an ObjectInputStream and retrieved using an ObjectOutputStream when the object's class implements the Serializable interface.

An object can be stored using an ObjectOutputStream and retrieved using an ObjectInputStream when the object's class implements the Serializable interface

Which of the following are true when you are designing test cases? A. Choose inputs that force the system to generate all error messages. B. Repeat the same input or series of inputs numerous times. C. Force invalid outputs to be generated. D. All of the above.

D. All of the above.

What problem can the consumer/producer cause? Infinite loop Bad programming Wasted memory Deadlock

Deadlock

What is the difference between checked and unchecked exceptions? Unchecked exceptions are not handled in a try-catch block, and checked exceptions may or may not be handled in a try-catch block. Unchecked exceptions are handled in a try-catch block, and checked exceptions are not. Unchecked exceptions may or may not be handled in a try-catch block, and checked exceptions must be handled in a try-catch block. Unchecked exceptions may or may not be handled in a try-catch block, and checked exceptions are not handled in a try-catch block.

Unchecked exceptions may or may not be handled in a try-catch block, and checked exceptions must be handled in a try-catch block.

How does a thread obtain the monitor for an object? Java is thread-safe and the JVM will handle race conditions by always allowing threads in the Running State to obtain the monitors they request. Threads executing a synchronized block of code will pass the monitor to the next thread. Effectively, the current thread will go to the Wait State. ExecutorService delivers monitors to threads in its Thread Pool fairly using methods (FIFO, Round Robin, etc) that are optimized and prevent starvation. When a thread enters a synchronized block of code, it obtains the monitor for that object.

When a thread enters a synchronized block of code, it obtains the monitor for that object.

How does a thread obtain the monitor for an object? When a thread enters a synchronized block of code, it obtains the monitor for that object. Threads executing a synchronized block of code will pass the monitor to the next thread. Effectively, the current thread will go to the Wait State. Java is thread-safe and the JVM will handle race conditions by always allowing threads in the Running State to obtain the monitors they request. ExecutorService delivers monitors to threads in its Thread Pool fairly using methods (FIFO, Round Robin, etc) that are optimized and prevent starvation.

When a thread enters a synchronized block of code, it obtains the monitor for that object.

When does deadlock occur? When the producer does not wait on a resource from the consumer, but the consumer waits on something from the producer. When the producer waits on a resource from the consumer, but the consumer is not waiting on something from the producer. When neither the producer nor the consumer is waiting on a resource from the other. When both the producer and consumer are waiting on resources from the other.

When both the producer and consumer are waiting on resources from the other.

Which of the following statements regarding Thread Priorities in the JVM is true? High Priority threads will always execute before threads with lower priority. Threads are scheduled directly in order from highest priority to lowest priority. When the JVM decides on the next thread to execute from the ready state, it follows a probabilistic algorithm. None of the above

When the JVM decides on the next thread to execute from the ready state, it follows a probabilistic algorithm.

What is the motto of Java? Better than C++. Run once, write anywhere. Write once, run anywhere. Platform-independent.

Write once, run anywhere.

What is the motto of Java? Better than C++ Run once, write anywhere Platform-indepenent Write once, run anywhere.

Write once, run anywhere.

By convention in Java, all classes start with...

a capital letter

Which of the following JavaScript statements will remove an element with ID 'navbar' from the document? del(document.id.navbar) remove(document.getElement('navbar').id) document.getElementById('navbar').clear() document.getElementById('navbar').remove()

document.getElementById('navbar').remove()

When this form is submitted with no data in the fields, what will the URL parameters be on submit.html? fname=&age=&lname=Submit&haircolor= fname=&age=&lname=&haircolor= fname=&age=&haircolor= There won't be any URL parameters since there was no data in the fields.

fname=&age=&lname=Submit&haircolor=

What is the signature of the method that acts as the entry point into a Java program? public static void main(String [] args) public void main(String [] args) static void main(String [] args) void main(char *argv[])

public static void main(String [] args)

Which of the following methods dispatches the request to the server when using AJAX? if (xhttp.responseText.trim().length > 0) { return false; } return true; open(method, url, async) send(); new XMLHttpRequest();

send();

In HTML, which element do we use to create an unordered list? al unordered_list ul li

ul

Which of the following is a valid expression for getting the value of a Java variable into a JavaScript variable? var name = <%= request.getParameter("name") %>; <% var name = request.getParameter("name") %>; var name = <% request.getParameter("name") %>; var name = "<%= request.getParameter("name") %>";

var name = "<%= request.getParameter("name") %>";

What type of inheritance does Java support? Single Hierarchical Java does not support inheritance Multiple

Single

What type of inheritance does Java support? Single Hierarchial Multiple Java does not support inheritance

Single

Which one of the following statements is true about Java's Serializable interface? An object can be stored using an ObjectOutputStream and retrieved using an ObjectInputStream when the object's class implements the Serializable interface. Static and private variables of an object are not saved when an object implements the Serializable interface. An object's state cannot be retrieved from an ObjectInputStream when the object's class implements the Serializable interface. An object can be stored using an ObjectInputStream and retrieved using an ObjectOutputStream when the object's class implements the Serializable interface.

An object can be stored using an ObjectOutputStream and retrieved using an ObjectInputStream when the object's class implements the Serializable interface.

What does System.gc() do? A. Takes out the trash immediately. B. Strongly hints the JVM to collect garbage. C. A and B D. Switches the garbage collector onto the main thread.

B. Strongly hints the JVM to collect garbage.

Do JSPs execute on the front end or back end?

Back end

Do JSPs execute on the front end or back end? Front end Back end Both It depends on the code

Back end

A parent class is also known as a what? Upper class Base class Senior class Child class

Base class

Why would you use JavaScript on the front end for form validation? Because this is the only place you can perform form validation. Because even though you also have to do it on the backend, JavaScript allows the form validation to happen without reloading the page or even submitting to the server. You can't. Form validation can only happen on the backend. Because you have a choice between doing it on the front end or the backend, so sometimes you choose the front end.

Because even though you also have to do it on the backend, JavaScript allows the form validation to happen without reloading the page or even submitting to the server.

Why does AJAX exist? To reload part of a page without refreshing the entire page. To asynchronously send data to the server to validate information. Both A and B Neither A nor B

Both

Why does AJAX exist? To reload part of a page without refreshing the entire page. To asynchronously send data to the server to validate information. Both A and B Neither A nor B

Both A and B

Which of the following are valid ways to correctly simulate the Producer and Consumer problem? Use the "synchronized" keyword. Use locks and conditions. Both of the above. Neither of the above.

Both of the above.

Which of the following is true regarding the "finally" block in a try-catch statement? A. The "finally" clause guarantees that the section of the code will be ran regardless of whether an exception was thrown. B. The "finally" clause is often used to close resources, such as BufferedReader. C. Both A and B D. Neither A nor B

C. Both A and B

Which of the following is true regarding the "finally" block in a try-catch statement? A. The "finally" clause guarantees that the section of the code will be ran regardless of whether an exception was thrown. B. The "finally" clause is often used to close resources, such as BufferedReader. C. Both A and B D. Neither A nor B

C. Both A and B

Which of the following are valid ways to correctly simulate the Producer and Consumer problem? A. Use the "synchronized" keyword. B. Use locks and conditions. C. Both A and B. D. Neither A nor B.

C. Both A and B.

What type of address is 79.125.0.0? Class A, Private Class B, Public Class A, Public Class B, Private

Class A, Public

Which of the following about abstract classes and interfaces is false? You implement an interface. Interfaces can have methods implemented. Abstract classes can have methods implemented. You extend an abstract class.

Interfaces can have methods implemented.

A memory location is a 'candidate' for garbage collection when: The memory location is referenced multiple times in the program. It is no longer referenced by any part of the program. The program removes one of the multiple pointers to the memory location. The program generates a pointer to the memory location.

It is no longer referenced by any part of the program.

Why shouldn't we use printStackTrace() in production? It doesn't do anything. It is not user friendly. It leaks your source code. It crashes the program.

It is not user friendly.

What is the purpose of the primary key? It provides a reference for that row in the table It links two tables together through a unique variable Both A and B Neither A nor B

It provides a reference for that row in the table

What is the purpose of the primary key? It provides a reference for that row in the table. It links two tables together through a unique variable. Both A and B Neither A nor B

It provides a reference for that row in the table.

What's the purpose of NAT (network address translation)? It connects the port number to the DNS server. It determines the IPv4 address class. It solves the problem that IPv6 has run out of available addresses. It replaces the private IP address with the public IP address on outgoing request.

It replaces the private IP address with the public IP address on outgoing request.

Which of the following statements regarding networking is/are true? Ports allow us to uniquely identify networked programs running on a single computer. All of the Above. Private IP Addresses can communicate outside local networks. Multiple computers on the same network can share the same IP address.

Ports allow us to uniquely identify networked programs running on a single computer.

Which of the following ranges of port numbers refers to ports that are registered and can be used by any application? Ports from 1024-49151 Ports from 0-1023 Ports from 49152-65535 None of these ranges

Ports from 1024-49151

Is 172.21.101.211 a public IP Address or a private IP Address? Public Private

Private

What is the producer/consumer problem, and why is it important? Producers insert items, consumers withdraw items, and this is an example of concurrent programming. Producers withdraw items, consumers insert items, and this is an example of parallel programming. Producers insert items, consumers withdraw items, and this is an example of parallel programming. Producers withdraw items, consumers insert items, and this is an example of concurrent programming.

Producers insert items, consumers withdraw items, and this is an example of concurrent programming.

What is the producer/consumer problem, and why is it important? Producers insert items, consumers withdraw items, and this is an example of concurrent programming. Producers withdraw items, consumers insert items, and this is an example of parallel programming. Producers withdraw items, consumers insert items, and this is an example of concurrent programming. Producers insert items, consumers withdraw items, and this is an example of parallel programming.

Producers insert items, consumers withdraw items, and this is an example of concurrent programming.

Given a table of state names, how would you select only the abbreviation and full name of California? SELECT full_name, abbreviation FROM us_state_info WHERE full_name='California' SELECT full_name, abbreviation FROM us_state_info IF state IS 'California' SELECT * FROM us_state_info WHERE full_name='California' AND abbreviation='CA' SELECT full_name, abbreviation FROM us_state_info

SELECT full_name, abbreviation FROM us_state_info WHERE full_name='California'

Assume 2 tables, students and grades exist in a database. students has columns id(INT), name(VARCHAR), class(VARCHAR), and grade_id(INT). grades has columns id(INT) and letter(VARCHAR). Choose the MALFORMED SQL query? SELECT s.name FROM student s WHERE grade_id < 2; SELECT id, name, letter FROM students s, grades g WHERE s.grade_id = g.id; SELECT * FROM students WHERE grade_id < 0; SELECT * FROM grades WHERE id > 10000;

SELECT id, name, letter FROM students s, grades g WHERE s.grade_id = g.id; id is ambiguous, could refer to either id in students or id in grades

Which of the following can restrict the number of threads that access a shared resource? Semaphores Thread Pools The Garbage Collector. Generics

Semaphores

What annotations are required for our WebSocket Endpoint Language? OnOpen, OnMessage, and OnClose ServerEndpoint, OnOpen, OnMessage, OnError OnOpen, OnChange, OnError, OnClose, On ServerEndpoint, OnOpen, OnMessage, OnError, OnClose

ServerEndpoint, OnOpen, OnMessage, OnError, OnClose

What is the correct way to make sure a form uses a servlet you created? Set the method attribute to POST in the form tag. Set the name attribute of the form tag to the name of the servlet. Set the name parameter in the url to the name of the servlet. Set the action attribute of the form to the name of the servlet.

Set the action attribute of the form to the name of the servlet.

What is the correct way to make sure a form uses a servlet you created? Set the name attribute of the form tag to the name of the servlet. Set the name parameter in the url to the name of the servlet. Set the method attribute to POST in the form tag. Set the action attribute of the form to the name of the servlet.

Set the action attribute of the form to the name of the servlet.

Which of the following is true about Servlets? The HttpRequest and HttpResponse may be omitted by the service function in a servlet. The annotation @WebServlet(<servlet_name>) must contain a '/' at the beginning. There are three function signatures used to handle requests, doPost, doGet, and doService. Spring Boot is a popular framework for front end programming.

The annotation @WebServlet(<servlet_name>) must contain a '/' at the beginning.

When acquiring a monitor on a static synchronized method, the monitor is acquired on what? The instance of the class The block of code using a shared variable The class The method

The class

When acquiring a monitor on a static synchronized method, the monitor is acquired on what? The method The block of code using a shared variable The instance of the class The class

The class

What is a socket? The combination of the IP address and port number needed by the client. The port number of the client and server connection. The IP address of the client The IP address of the server

The combination of the IP address and port number needed by the client.

Which statement below is false? AJAX uses a browser built-in XMLHttpRequest object AJAX applications can transport data as JSON text Updates to a page made via AJAX will not be displayed until the client's window is refreshed AJAX stands for Asynchronous JavaScript And XML

Updates to a page made via AJAX will not be displayed until the client's window is refreshed

Which of these data types are thread-safe? Vector ArrayList HashMap LinkedList

Vector

If a thread cannot acquire the monitor on a synchronized block of code, to what state does it move? Dead Waiting Ready Sleeping

Waiting

What is the correct way to implement the fork/join framework so that we can process asynchronously and return the value? We override the compute() method and call the invoke() method on the ForkJoinPool object. We override the compute() method and call the start() method on the ForkJoinPool object. we override the run() method after extending Thread or implementing Runnable interface and call execute() on ForkJoinPool. We recursively use conditional statements (if&else/while/switch) to call fork() and join().

We override the compute() method and call the invoke() method on the ForkJoinPool object.

What is the correct way to implement the fork/join framework so that we can process asynchronously and return the value? We override the compute() method and call the invoke() method on the ForkJoinPool object. We override the compute() method and call the start() method on the ForkJoinPool object. We recursively use conditional statements (if&else/while/switch) to call fork() and join(). we override the run() method after extending Thread or implementing Runnable interface and call execute() on ForkJoinPool.

We override the compute() method and call the invoke() method on the ForkJoinPool object.

What is the correct way to implement the fork/join framework so that we can process asynchronously and return the value? We override the compute() method and call the invoke() method on the ForkJoinPool object. We recursively use conditional statements (if&else/while/switch) to call fork() and join(). We override the run() method after extending Thread or implementing Runnable interface and call execute() on ForkJoinPool. We override the compute() method and call the start() method on the ForkJoinPool object.

We override the compute() method and call the invoke() method on the ForkJoinPool object.

Ports from 0-1023 (inclusively) can be used by: The operating system when an application needs to pass an application off to a non-registered port Any application People who enjoy dessert wines. Well-known applications, so root or administrator access is required.

Well-known applications, so root or administrator access is required.

How does a thread obtain the lock for an object? ExecutorService delivers locks to threads in its Thread Pool fairly using methods (FIFO, Round Robin, etc) that are optimized and prevent starvation. Java is thread-safe and the JVM will handle race conditions by giving the lock to the thread in the Running State. Threads executing a synchronized block of code will pass the lock to the next thread. Effectively, the current thread will go to the Wait State. When a thread enters a synchronized block of code, it obtains the lock for that object.

When a thread enters a synchronized block of code, it obtains the lock for that object.


Kaugnay na mga set ng pag-aaral

Chapter 9 practice questions- PrepU

View Set

Vocabulary From "The sailor Who Fell From Grace With The Sea"

View Set

Different Functional Areas of Management

View Set

blood pressure and pulse determination

View Set

EMT Chapter 19 Endocrine and Hematologic Emergencies

View Set