CSCI201L Final
CSCI201L Final Quiz
Test your knowledge and skills in web development concepts, Java servlets, and database management with our CSCI201L Final Quiz. This quiz is designed for students who want to prepare for their exams and reinforce their understanding.
- Multiple choice questions
- Covers key concepts in AJAX, JSP, SQL, and more
- Instant feedback after each question
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
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
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
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.
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
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
Do JSPs execute on the front end or back end?
Front end
Back end
Both
It depends on the code
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()
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");
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") %>";
In HTML, which element do we use to create an unordered list?
Al
Unordered_list
Ul
Li
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.
Which one presents the correct ways for creating CSS selectors?
Classname, #idname, .tagname
#classname, .idname, tagname
.classname, idname, #tagname
.classname, #idname, tagname
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.
What does HTML stand for?
Hyper Text Markup Language
Hypertext Transfer Markup Language
Hyper Text Modeling Language
None of the above
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.
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.
Which of the following SQL statements creates this table?
0%
0
0%
0
0%
0
0%
0
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)
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
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');
Which of the following is/are provided by a Relational Database Management System?
Security
Structure
Design
All of the above
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
What does a client application need to connect to a server application?
IP address
Socket
Port
All of the above
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");
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.
What type of address is 79.125.0.0?
Class A, Private
Class B, Public
Class A, Public
Class B, Private
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
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.
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
Is 172.21.101.211 a public IP Address or a private IP Address?
Public
Private
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
How many 32 bit IPv4 addresses are there?
Unlimited
One billion
Over four billion
10 billion
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
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.
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.
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.
The following function prevents deadlock by signaling to whoever is waiting:
.sleep()
.wait()
.await()
.notify()
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.
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.
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.
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.
Does parallelizing code always mean faster execution?
Not always
No
Yes
Java does not offer parallel programming
If a thread cannot acquire the monitor on a synchronized block of code, to what state does it move?
Dead
Waiting
Ready
Sleeping
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.
Which thread method do you call if you want to begin a thread's execution?
Yield
Sleep
Run
Start
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.
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
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.
Which of the following must be handled in a try-catch block?
NoClassDefFoundError
IOException
NullPointerException
All of the above
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.
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.
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()
What type of inheritance does Java support?
Single
Hierarchial
Multiple
Java does not support inheritance
A parent class is also known as a what?
Upper class
Base class
Senior class
Child class
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.
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
{"name":"CSCI201L Final", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge and skills in web development concepts, Java servlets, and database management with our CSCI201L Final Quiz. This quiz is designed for students who want to prepare for their exams and reinforce their understanding.Multiple choice questionsCovers key concepts in AJAX, JSP, SQL, and moreInstant feedback after each question","img":"https:/images/course4.png"}