CSCI 201 Post Midterm Quiz Study Set

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which of the following is the correct way of serializing an object? a) FileOutputStream out = new FileOutputStream("output.ser"); out.writeObject(new int[]{1,2,3}); b) ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("output.ser")); out.writeBytes(new int[]{1,2,3}); c) FileOutputStream out = new FileOutputStream("output.ser"); out.write(new int[]{1,2,3}); d) ObjectOutputStream out = new ObjectOutputStream(newFileOutputStream("output.ser")); out.writeObject(new int[]{1,2,3});

d) ObjectOutputStream out = new ObjectOutputStream(newFileOutputStream("output.ser")); out.writeObject(new int[]{1,2,3});

Which state is the thread in when it has been created and started? a) Waiting b) Sleeping c) Running d) Ready

d) Ready

What does this query do? SELECT e.firstName, c.car FROM Employee e, Cars c WHERE firstName = 'Alex'; a) Returns all cars b) Invalid because you cant select from two different tables c) Returns only one column with the cars associated to Alex d) Returns one column of first name equal to Alex and a column of cars associated with the first name

d) Returns one column of first name equal to Alex and a column of cars associated with the first name

Which of the following is not a valid transition between threads a) Start -> Ready b) Ready -> Waiting c) Running -> Ready d) Waiting -> Sleeping

d) Waiting -> Sleeping

A monitor... a) cannot be created b) must extend the monitor class c) must implement the monitor interface d) can be any object

d) can be any object

A monitor is an object with ____ exclusion and synchronization capabilities. a) parallel b) multi-threaded c) conflicting d) mutual

d) mutual

The lock for a synchronized, non-static method is on the _____, and for a synchroinzed static method it is on the ________ a) object, object b) class, object c) class, class d) object, class

d) object, class

How are exceptions handled? a) they cannot be handled b) the finally clause c) the throw clause d) the catch clause

d) the catch clause

How to select a html element with ID called top in CSS? A) #top{ } B) .top{ } C) ID.top{ } D) top{ }

A) #top{ }

Which of the following is NOT a reserved port for well known applications? A) 1024 B) 443 C) 20 D) 143

A) 1024

The following HTML is an example of what? <ol> <li> Tiny Brain </li> <li> Big Brain </li> <li> Celestial Brain </li> </ol> A) An ordered list B) An orthogonal list C) A description list D) An unordered list

A) An ordered list

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

A) Forking and joining has their own overhead.

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

A) It provides a reference for that row in the table

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

A) Ports from 1024-49161

Ajax is used to... A) Reload part of the page B) Reload all of the page C) Direct the user to a new page D) None of the above

A) Reload part of the page

What is true about IPV6? A) Subnetting exists in IPv6, but because there are so many bits in the IP address, we don't need to take bits from the host. B) Subnetting does not exists in IPv6. C) Slash notation cannot be used to identify the number of bits used in the network and subnet. D) Subnetting exists in IPv6, and we can take a few bits away from the host address to make a subnet within a network.

A) Subnetting exists in IPv6, but because there are so many bits in the IP address, we don't need to take bits from the host.

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

A) The annotation @WebServlet(servlet_name) must contain a '/' at the beginning

Multiple threads can be inserting and taking elements concurrently from BlockingQueue, without any concurrency issues arising. A) True B) False

A) True

Serverless architectures and containers are the solutions to money and time problems. A) True B) False

A) True

With Virtual Machines, it is difficult to predict the size of the VM instance. A) True B) False

A) True

What is the purpose of the IFRAME element? A) embed a site B) embed a plug-in C) reserve a rectangular region D) hyperlink to a site

A) embed a site

How can a Condition object for a Lock named lock be created? A) lock.newCondition() B) lock.CreateNewConditon() C) lock.Condition = new Condition() D) You cannot create conditions for locks

A) lock.newCondition()

Which of the following are true about Java servlets? Choose all that apply A) Servlets can process data through doGet(), doPost(), and service() B) Servlets are compiled and executed on the server, but then generate client-side code to send back to the browser C) Servlets are Java classes that can serve dynamic web content D) Servlets are Java classes that inherits from HttpServlet class

All of the above

In HTML, which element do we use to create an ordered list? A) <li> B) <ol> C) <ordered_list> D) <ul>

B) <ol>

Which of the following should have a socket in Java? A) Neither the server nor the client B) Both the server and the client C) Client D) Server

B) Both the server and the client

What type of address is 79.125.0.0? A) Class A. B) Class A, Public C) Class B, Public D) Class B, Private,B)

B) Class A, Public

Routers use two primary algorithms: A) Graph Theory and Distance Vector B) Distance Vector and Link State C) Pattern recognition and Link State D) Link State and State Machine

B) Distance Vector and Link State

Finding a route is a very complicated process, and although you can find it running traceroute on a Mac or Linux computer from the terminal, there are no commands that can be used to find a route on Windows. A) True B) False

B) False

You can't have a webpage without a separate CSS file A) True B) False

B) False

Select the correct statement from the following options. A) Parallelizing code always speeds it up. B) If you fork more threads than your CPU's, the threads will execute concurrently. C) Forking a task causes no overhead D) All of the above.

B) If you fork more threads than your CPU's, the threads will execute concurrently.

What's the purpose of NAT (network address translation) A) It determines the IP address class B) It replaces the private IP address with the public IP address on outgoing requests C) It solves the problem that IPV6 has run out of available addresses D) It connects the port number to the DNS server

B) It replaces the private IP address with the public IP address on outgoing requests

Which of the following is not a front-end web language? A) CSS B) Java C) JavaScript D) HTML

B) Java

The server socket can have ________ connections. Whenever a connection is established, a new __________ is created to handle communication between the server and the new client. Complete the blanks respectively: A) One, thread B) Many, thread C) Two, DNS D) One, DNS

B) Many, thread

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

B) The thread remains in the waiting state forever.

There are only two types of software components that may be used in the reuse-oriented process: - Web services that are available for remote invocation (called "end-points") - Collections of objects developed as a package, such as J2EE or .NET A) True B) false

B) false

What function can be used to get a single HTML element from the page? A) getElementByName() B) getElementById() C) getElement() D) getElementByClassName()

B) getElementById()

JavaScript can be included in which HTML tag? A) JavaScript can't be in a tag, it should be an external file B) script C) javascript D) script:javascript

B) script

What variable is available to us inside the xhttp.onreadystatechange callback in order to check the state of our request? A) this.currentStatus B) this.readyState C) this.state D) this.currentState

B) this.readyState

Consider the address www.usc.edu A) www.usc.edu is the hostname B) www is the hostname (or an alias for a hostname) and usc.edu is the domain name C) www.usc.edu is the domain name D) www is the domain name and usc.edu is the hostname (or an alias for a hostname)

B) www is the hostname (or an alias for a hostname) and usc.edu is the domain name

Assume a host has an IP address of 74.125.127.104 with a subnet mask of 255.255.255.192 (also written as 74.125.127.104/26) What is the network address? A) 73.0.0.0 B) 255.255.255.0 C) 74.0.0.0 D) 75.0.0.0

C) 74.0.0.0

What decorator denotes an error function for a Java ServerSocket? A) @OnNull B) @OnException C) @OnError D) @OnClose

C) @OnError

What is an *.sql file? A) A configuration file for MySQL. B) A configuration file for your specific workspace. C) A scaffold of your database. D) A complete record of the database.

C) A scaffold of your database.

Why is multithreading useful in network applications? A) To allow client and servers to run simultaneously B) To allow the server to serve multiple client simultaneous C) All of the above D) None of the above

C) All of the above

What is the difference between and ID Attribute and a CLASS Attribute in CSS? A) No difference B) A CLASS Attribute can only be used once C) An ID attribute can only be used once D) An ID Attribute can be used multiple times

C) An ID attribute can only be used once

Can I have two primary keys in a table? A) Yes, but you must edit the SQL config.ini file to enable this feature. B) Yes, there can be multiple primary keys. C) No, there can only be one primary key but it can span multiple columns. D) No, there can only be one primary key spanning exactly one column.

C) No, there can only be one primary key but it can span multiple columns.

What are fundamental activities common to all software? A) Validation and Evolution only B) Specification and Development only C) Specification, Development, Validation and Evolution D) Specification, Development and Validation only

C) Specification, Development, Validation and Evolution

// Server class code @ServerEndpoint(value = ""/exam"") public class ServerSocket { @OnMessage public void onMessage(String message, Socket session) { session.println(message); session.flush(); } } What happens upon receiving new messages? A) The code doesn't compile. B) The received message is sent back to the server. C) The received message is printed to the server. D) Nothing is done with the received message.

C) The received message is printed to the server. this actually may be wrong idk

If a thread cannot acquire the monitor on a synchronized block of code, to what state does the thread move? A) Dead B) Sleeping C) Waiting D) Ready

C) Waiting

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

C) send();

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

D) A table

What does a client application need to connect to a server application? A) IP Address B) Socket C) Port D) All of the Above

D) All of the Above

AWS Lambda Architecture provides... A) Microservices B) API Management C) No server to manage D) All of the above

D) All of the above

Containers... A) Are based on Linux kernel B) were brought to mainstream by Docker C) Virtualize at the OS level D) All of the above

D) All of the above

FaaS... A) is Function as a Service B) is Custom Code C) Runs on ephemeral containers D) All of the above

D) All of the above

What are the main difference between Ajax and the "classic" application model? A) In classic model, the web server responds with CSS and HTML B) In Ajax, the Ajax engine builds the HTML and CSS C) In Ajax, the server sends XML or JSON data D) All of the above

D) All of the above

Which of the rule/rules below belong to Multithreading Programming? A) Use one lock for one resource. B) Always acquire locks in the same order in different threads. C) Always release locks in the opposite order they were acquired D) All of the above

D) All of the above

Examine the following code: <nav> <a href="/html/">HTML</a> | <a href="/css/">CSS</a> | <a href="/js/">JavaScript</a> | <a href="/java/">Java</a> </nav> What is this an example of? A) JavaScript B) CSS C) Java D) HTML

D) HTML

How can you ensure that the form utilizes a specific servlet? A) Set the name attribute of the form tag to the name of the servlet B) Set the method attribute to POSt in the form tag C) Set the name parameter in the url to the name of the servlet D) Set the action attribute of the form to the name of the servlet

D) Set the action attribute of the form to the name of the servlet

Semaphores ______ A) can be used to enforce mutual exclusion B) can allow multiple threads access to a shared resource C) are a locking mechanism D) all of the above

D) all of the above

Which of the following is NOT a method for monitors? A) notify() B) notifyAll() C) wait() D) awake()

D) awake()

Which of the following is NOT true regarding buffer "flushing"? A) Data is written to a buffer before it is sent along the socket. B) You can explicitly call the flush function C) Buffer will not be transmitted until full unless you explicitly call "flush". D) Buffer will automatically flush when it is no longer in use.

D) will automatically flush when it is no longer in use.

What would make a manager say that a software project has failed? A) Not functional or buggy B) Missing critical features C) Over Schedule D) Over Budget E) All of the above

E) All of the above

A NAT server(usually implemented in a router) generates a private IP address to the computerTrue or False?

False

What is the relationship between Thread and Runnable? a) A Thread object is also a Runnable b) Runnable implements Thread c) There is no relationship d) They are sibling classes

a) A Thread object is also a Runnable

Polymorphism means that: a) A variable of a supertype can refer to a subtype object b) A variable of a subtype can refer to a supertype object c) Both option 1 and 2 d) Neither of the options

a) A variable of a supertype can refer to a subtype object

What does DBMS stand for, and who was it defined for? a) Database Management System, programmers (specials) b) Developer Book for Managing SQL, programmers c) Database Management System, casual users d) David Bowie Makes Songs, musicians

a) Database Management System, programmers (specials)

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

a) Start

When a method with the _________ keyword in its signature is running, only one thread can be inside that method at a time. a) Synchronized b) Locking c) Shared d) Thread

a) Synchronized

A thread cannot acquire a lock owned by another thread a) True b) False

a) True

Through the JDBC Connection interface, more specifically, the createStatement method , you can interact with the database e.g., creating a Statement to execute SQL queries against tables. a) True b) False

a) True

__________ is an example of polymorphism in Java. a) When two subclasses override a method from their common superclass with different implementations b) When a subclass implements multiple interfaces c) When a method id overloaded with multiple signatures d) All of the above are examples of different types of polymorphism

a) When two subclasses override a method from their common superclass with different implementations

An interface may... a) not contain generic types b) not contain constants and static methods c) contain non-default method implementations d) contain constants and static methods

a) not contain generic types

A thread cannot acquire lock owned by another thread a) true b) false

a) true

In Java how do we create a Thread? a) Create a class, but call it "Thread" b) Create a class with a function called run() and implement the Runnable interface c) Just create a class d) All variables are threads

b) Create a class with a function called run() and implement the Runnable interface

Threads have priorities that the system imposes over them according to the work requested by them. The user does not have the option to set thread's priorities a) True b) False

b) False

Which SQL statement is used to insert new data in a database? a) ADD NEW b) INSERT INTO c) ADD RECORD d) INSERT NEW

b) INSERT INTO

Which of the following is a difference between Parallel and Distributed Programming? a) Parallel programming runs on the same CPU, while distributed dispatches work to many CPU's b) Parallel programming typically utilizes different CPU's on the same machine while distributed typically dispatches work to other computers c) There is no difference between distributed and parallel programming d) Distributed programming typically utilizes different CPU's on the same machine, while parallel programming typically dispatches work to other computers

b) Parallel programming typically utilizes different CPU's on the same machine while distributed typically dispatches work to other computers

Which of the following do relational databases NOT provide? a) Integrity b) Security c) Structure d) Language

b) Security

What type of inheritance does Java have? a) Multiple inheritance b) Single inheritance c) Polymorphism d) Abstract

b) Single inheritance

Which of the following is true about Distributed Programming? a) Speed up execution of your program by using redundant resources typically on your computer b) Speed up execution of your program by using resources typically on other computers c) Add functionality to your program d) None of the above

b) Speed up execution of your program by using resources typically on other computers

When using monitors, what does calling notify() do? a) notify() wakes up all threads waiting on this object's monitor b) notify() wakes up a single thread on this object's monitor c) notify() waits the current thread d) notify() sends message to the garbage collector to collect this thread

b) notify() wakes up a single thread on this object's monitor

What is the smallest number of threads running at any time in a Java program? a) 4 b) 1 c) 2 d) 3

c) 2

When in a try clause, where do you go if an exception is thrown? a) Nowhere, since there is a runtime error b) The throw clause c) The catch clause d) Another try clause

c) The catch clause

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

c) Waiting

How can we handle a block of code that might throw more than one type of Exception? a) Multiple try-catch blocks b) One try and multiple catch blocks c) Specifying an exception type in the catch-statement that is a superclass to all possible exception types d) All of the above

d) All of the above

What is a thread pool used for? a) Managing the number of threads executing concurrently b) If a thread in a pool completes execution, it can be reused instead of needing to create another thread c) If a thread terminates due to failing, another thread will be created to replace it d) All of the above

d) All of the above

Which of the following is a characteristic of concurrent programming? a) Multi-threaded Programming b) Parallel Programming c) Distributed Programming d) All of the above

d) All of the above

Polymorphism requires _____ a) An abstract class b) An interface c) A default method implementation d) Any of the above

d) Any of the above

if a thread is a Thread object, calling thread.sleep(10) will cause the thread to sleep for a) At most 10 ms b) Exactly 30 ms c) Approximately 10 ms(more or less) d) At least 10 ms

d) At least 10 ms

A monitor is an object ____ exclusion and synchronization capabilities. a) Parallel b) Conflicting c) Multi-threaded d) Mutual

d) Mutual

In what class is monitor functionality implemented? a) Unit class b) Lock class c) Sync class d) Object class

d) Object class

What is the purpose of try-catch statement? a) to pass an object to another object b) to do object inheritance without halting the program c) to pass an exception to another exception d) to handle exceptions without halting the program

d) to handle exceptions without halting the program

Explain why the following IP address/subnet combination does not make sense. › 221.14.25.124/22

idk the answer but papa said it might be on exam


Set pelajaran terkait

What is Motivation? End of Lesson Test

View Set