Everything 201 (copy)

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/1007

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

1008 Terms

1
New cards

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

A)

an underscore

B)

a number

C)

a lowercase letter

D)

a capital letter

D) a capital letter

2
New cards

What is the motto of Java?

A)

Write once, run anywhere.

B)

Platform-independent.

C)

Run once, write anywhere.

D)

Better than C++

A) Write once, run anywhere.

3
New cards

Java is platform-dependent

False

4
New cards

The following access modifier allows any other piece of code to access the variable or method

Public

5
New cards

Which Java IDE will be used in the class and by the graders?

A)

Eclipse

B)

BlueJ

C)

IntelliJ

D)

NetBeans

A) Eclipse

6
New cards

Where are files stored in a computer system?

A)

Volatile memory

B)

Non-volatile memory

C)

Cache

D)

Main memory

B) Non-volatile memory

7
New cards

With SQL, how do you select all the records from a table names "Persons" where the value of the column "FirstName" is "Peter"?

SELECT * FROM Persons WHERE FirstName='Peter'

8
New cards

How are Java objects allocated?

A)

All Java objects are statically-allocated.

B)

All Java objects are dynamically-allocated.

C)

Java doesn't have objects but just primitive variable types.

D)

Java gives the programmer the ability to allocate objects either dynamically or statically.

B) All Java objects are dynamically-allocated.

9
New cards

Which of the following is the correct way of serializing an object?

A)

ObjectOutputStream out = new ObjectOutputStream(newFileOutputStream("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.writeObject(new int[]{1,2,3});

D)

FileOutputStream out = new FileOutputStream("output.ser");

out.write(new int[]{1,2,3});

A) ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("output.ser"));

out.writeBytes(new int[]{1,2,3});

10
New cards

Server hardware is typically more robust and expensive than other hardware, but a server can physically be any computer.

11
New cards

What are the solutions to the cross-domain issue for resources such as JavaScript of JSON?

A) Use a server "proxy"

B) Use CORS, if available

C) Access exclusively resources in the same domain

D) All of the above

D) All of the above

A) Use a server "proxy"

B) Use CORS, if available

C) Access exclusively resources in the same domain

12
New cards

Which of the following is true?

A)

If a method only exists in the child and you have an instance of a parent, you can still call the method from the child.

B)

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

C)

Both A and B

D)

Neither A nor B

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

13
New cards

A parent class is also known as what?

A)

Child class

B)

Upper class

C)

Senior class

D)

Base class

D) Base class

14
New cards

Which of the following is true about Buffers used in non-blocking APIs introduced in NIO/NIO.2?

Write data into a buffer using the buffer's wrap() method and the channel write() method

15
New cards

Which of the following is true about Java inheritance?

A)

Java does not support inheritance.

B)

Java supports single inheritance.

C)

Java supports multiple inheritance.

D)

Java supports single and multiple inheritance.

B) Java supports single inheritance.

16
New cards

What type of inheritance does Java support?

A)

Java does not support inheritance

B)

Multi-Dimensional

C)

Multiple

D)

Single

D) Single

17
New cards

Which of the following statements regarding Thread Priorities in the JVM is true?

A)

High priority threads will always execute before threads with lower priority.

B)

Threads are scheduled in order from highest priority to lowest priority.

C)

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

D)

None of the above

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

18
New cards

Which of the following is not a common cause of starvation?

- Threads waiting their turn run the risk of potentially losing pieces of data as memory is overwritten

19
New cards

Java enables you to acquire Locks explicitly, which give you more control for coordinating

Threads

20
New cards

From the ready state, to which states can a given thread move directly to?

Running

21
New cards

All thread states can transition to the Ready state except for:

Dead state

22
New cards

What is not an advantage of multithreading?

A)

Testing/debugging is usually relatively straightforward, in comparison to other approaches

B)

The independent nature of threads means other threads are not affected if an exception occurs in one

C)

It doesn't block the user from performing other tasks

D)

One can save time by performing many tasks togethe

A) Testing/debugging is usually relatively straightforward, in comparison to other approaches

23
New cards

A thread with a priority of 10 will run before a thread with a priority of 1.

A)

This is always true

B)

This is never true

C)

This is sometimes true

D)

None of the above

C) This is sometimes true

24
New cards

What is the major difference between jQuery AJAX and XMLHttpRequest (XHR)

A) jQuery does not support all browsers while XHR does

B) jQuery is Google's reimplentation of XHR from scratch for improved usability and efficiency

C) jQuery is optimized for asynchronous use cases while XHR is not

D) There is no major difference aside from syntactical sugar

D) There is no major difference aside from syntactical sugar

25
New cards

Which of the following is false, on the topic of differences between processes and threads?

A)

Processes are independent, threads are a subset of a process

B)

Processes have different address space in memory, whereas threads contain a shared address space

C)

Communication between processes is slower and more costly in comparison to communication between threads

D)

Context switching is faster between processes in comparison to threads

D) Context switching is faster between processes in comparison to threads

26
New cards

If thread is a Thread object, calling thread.sleep(10) will cause the thread to sleep for ________

A)

approximately 10 milliseconds (could be more, could be less)

B)

exactly 10 milliseconds

C)

at least 10 milliseconds

D)

at most 10 milliseconds

C) at least 10 milliseconds

27
New cards

How does a thread obtain the lock for an object?

A)

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

B)

ExecutorService delivers locks to threads in its Thread Pool fairly using methods (FIFO, Round Robin, etc) that are optimized and prevent starvation.

C)

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.

D)

Java is thread-safe and the JVM will handle race conditions by giving the lock to the thread in the Running State

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

28
New cards

What does calling Executor.newFixedThreadPool(3) do?

Creates a thread pool that reuses a fixed number of threads. At any point, a maximum of 3 threads will be alive

29
New cards

A monitor is an object with _____ exclusion and synchronization capabilities.

A)

multi-threaded

B)

mutual

C)

conflicting

D)

parallel

B) mutual

30
New cards

In what class is monitor functionality implemented?

A)

Unit class

B)

Object class

C)

Sync Class

D)

Lock class

B) Object class

31
New cards

The lock for a synchronized, non-static method is on the _____, and for a synchronized, static method it is on the ___.

A)

class, class

B)

object, class

C)

object, object

D)

class, object

B: object, class

32
New cards

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.

33
New cards

Which of the following statements regarding semaphores is correct?

A)

A thread can release permits on a semaphore even without having them.

B)

A thread must acquire one of the permits of the semaphore before executing code managed by a semaphore.

C)

The number of permits available on a semaphore is specified at creation.

D)

All of the above.

D) All of the above.

A) A thread can release permits on a semaphore even without having them.

B) A thread must acquire one of the permits of the semaphore before executing code managed by a semaphore.

C) The number of permits available on a semaphore is specified at creation.

34
New cards

Why is a performance increase not guaranteed for parallel computing?

A)

Parallel computing adds functionality and does not increase performance.

B)

Network delays cause performance bottlenecking.

C)

Modern-day CPUs have sufficient single-core performance.

D)

Forking and joining has their own overhead.

D) Forking and joining has their own overhead.

35
New cards

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

36
New cards

What is the producer/consumer problem, and why is it important?

A)

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

B)

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

C)

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

D)

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

B

37
New cards

Which of the following is NOT true about semaphores?

A)

A thread can release permits on a semaphore even without having them.

B)

Semaphores can restrict the number of threads that access a shared resource.

C)

Only one permit is available on a semaphore.

D)

The number of permits available on a semaphore is specified at creation.

C (Only one permit is available on a semaphore.)

Question asking not true

38
New cards

Which of the following is true about subnets?

a)

In order to achieve subnetting, we take away bits form the host in both IPv4 and IPv6

b)

A subnet mask can be written as "/# of zeros"

c)

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

d)

In IPv6 the subnet bits are 65-128

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

39
New cards

When you instantiate your non-static class instance members, where are they created in memory?

Heap

40
New cards

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

41
New cards

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

A)

Public

B)

Private

C)

Both

D)

Neither

B --> class B

42
New cards

Which of the following is NOT a reserved port for well known applications?

a)

143

b)

443

c)

20

d)

1024

d

43
New cards

Which of the following statements regarding software engineering is correct?

A)

An increase in testing costs will bring down the cost of software maintenance.

B)

Pair programming with junior programmers can decrease the overall cost of a software product.

C)

Software project cost estimation is not known until the technical specifications are written.

D)

All of the above

B or D IDK

44
New cards

Which does a client application need to connect to a server application?

A)

IP Address

B)

Socket

C)

Port

D)

All of the above

D

45
New cards

What's the purpose of NAT (network address translation)?

A)

It solves the problem that IPv6 has run out of available addresses.

B)

It connects the port number to the DNS server.

C)

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

D)

It determines the IPv4 address class.

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

46
New cards

Which does a client application need to connect to a server application?

A)

IP Address

B)

Socket

C)

Port

D)

All of the above

D

47
New cards

What's the purpose of NAT (network address translation)

A)

It connects the port number to the dns server

B)

It determines the IP address class

C)

It solves the problem that ipv6 has run out of available addresses

D)

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

D

48
New cards

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-49151

b)

Ports from 0-1023

c)

Ports from 49152-65535

d)

None of these ranges

a) Ports from 1024-49151

49
New cards

What is a socket?

A)

Socket is the IP address of the server.

B)

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

C)

Socket is the IP address of the client.

D)

Socket is the port number of the client and server connection.

B) Socket is the combination of the IP address and port number needed by the client.

50
New cards

How would we create a socket connecting to port 6789 of the loopback address?

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

51
New cards

Which of the followings are needed for a socket to connect to a server application?

A. IP address of the server;

B. the port on which the server application is listening;

C. IP address of the client;

D. client's port number.

A and B

52
New cards

Suppose you wrote server code that will send messages out to all clients. The clients are single-line monitors that will display your received message without processing it.

The problem is that, when the clients are receiving messages, they receive a newline with it and it wipes the original message.

In your server code, you've written "pw.println(str); pw.flush();" where pw is an instance of a PrinterWriter object that writes to an output stream.

What is a correct way to fix this (so that a newline is not sent)?

1)

Rewrite the first quoted server-code line as "pw.println(str.replace("\n", ""));"

2)

After writing "pw.println(str)", fill the buffer with white-space characters so that flush() can not insert a newline character

3)

Rewrite the first quoted server-code line as "pw.print(str);"

4)

The string must be reprocessed by the client to remove the newline character

3) Rewrite the first quoted server-code line as "pw.print(str);"

53
New cards

Which keyword is used to declare a subclass?

- Extends

54
New cards

Which of the following is not a way to declare a String names s, with the value "ucla sucks"?

String s = ['u', 'c', 'l', 'a',' ', 's', 'u', 'c', 'k', 's'];

55
New cards

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

56
New cards

Which of the following statements regarding networking is/are true?

A)

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

B)

Private IP Addresses can communicate outside local networks.

C)

Multiple computers on the same network can share the same IP address.

D)

All of the Above

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

57
New cards

What's the purpose of NAT (network address translation)?

A)

It solves the problem that IPv6 has run out of available addresses.

B)

It connects the port number to the DNS server.

C)

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

D)

It determines the IPv4 address class.

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

58
New cards

What are the key interfaces to develop a database application with JDBC?

DriverManager, Connection, Statement and ResultSet

59
New cards

Which of the following statements is NOT true about conditions?

A condition is created by instantiating the Condition class.

60
New cards

Given these two tables:

CREATE TABLE Students{ID int(11) primary key not null auto_increment;firstname varchar(50) not null,lastname varchar(50) not null,country varchar(50) not null,};

Which one of these queries are correct to change student with ID 10 country to 'United States' ?

A)

SET Students s, s.country = 'United States'' WHERE s.ID = 10;

B)

You can't update values in SQL you have to deleted the entry and add a new one.

C)

CHANGE Students s, s.country ='United States'' WHERE s.ID = 10;

D)

UPDATE Students s SET s.country ='United States'' WHERE s.ID = 10;

D) UPDATE Students s SET s.country ='United States'' WHERE s.ID = 10;

61
New cards

______ is a key used to link two tables together

A) Primary Key

B) Foreign Key

C) Tertiary key

D) Secondary Key

Foreign Key

62
New cards

What is the effect of a WHERE clause?

conditional cut

63
New cards

What is the effect of changing from SELECT * to SELECT g.Grade?

vertical cut

64
New cards

How could you normalize a table that has a persons name, social security number, date of birth, and list of properties they own?

A)

Make names its own table with the name as the primary key, and the date of birth as a foreign key.

B)

This table is already as normalized as it can be.

C)

Make the property names an array instead of a column

D)

Make the social security number its own table with the social security number as the primary key, and the date of birth and name as columns. Then also make a properties table with a property id, property name, and social security number as the foreign key.

D) Make the social security number its own table with the social security number as the primary key, and the date of birth and name as columns. Then also make a properties table with a property id, property name, and social security number as the foreign key.

65
New cards

Given a table of state names, how would you select only the abbreviation and full-name of California?

A)

SELECT full_name, abbreviation FROM us_state_info IF state IS 'California'

B)

SELECT * FROM us_state_info WHERE full_name='California' AND abbreviation='CA'

C)

SELECT full_name, abbreviation FROM us_state_info

D)

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

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

66
New cards

What is the purpose of the IFRAME element?

A)

reserve a rectangular region

B)

hyperlink to a site

C)

embed a plug-in

D)

embed a site

D

67
New cards

How do you add CSS to HTML? Choose all that apply

In an external file that is included in an HTML document in the tag

In the

68
New cards

Which of the following is not a front-end web language?

A)

CSS

B)

HTML

C)

JavaScript

D)

Java

D) Java

69
New cards

Which one presents the correct ways for creating CSS selectors?

A)

.classname#idnametagname

B)

.classnameidname#tagname

C)

classname#idname.tagname

D)

#classname.idnametagname

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

70
New cards

What is the "novel" idea that Tim Berners-Lee invented?

A)

Hyperlinking

B)

HTML and CSS

C)

Hypercard

D)

Deep Linking

A) Hyperlinking

71
New cards

What does HTML stand for?

A)

Hyper Text Markup Language

B)

Hyper Text Modeling Language

C)

Hypertext Transfer Markup Language

D)

None of the above

A) Hyper Text Markup Language

72
New cards

What is the correct way to make sure a form uses a servlet you created?

A)

Set the name parameter in the url to the name of the servlet.

B)

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

C)

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

D)

Set the method attribute to POST in the form tag.

B

73
New cards

Why would you use JavaScript on the front end for form validation?

A)

You can't. Form validation can only happen on the backend.

B)

Because this is the only place you can perform form validation.

C)

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.

D)

Because you have a choice between doing it on the front end or the backend, so sometimes you choose the front end.

C

74
New cards

Where do JavaScript functions belong?

A)

Anywhere in the html file

B)

In an external html file

C)

in the tag

D)

in the tag

D

75
New cards

Which of the following are true about Java servlets?

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)

All of the above.

D

76
New cards

Which of the following are true about AJAX:

AJAX uses JavaScript and HTML DOM to display the data

AJAX stands for Asynchronous JavaScript and XML

AJAX Json object offers two methods: parse() and stringify

AJAX allows for just part of a apage to be reloaded with direct access to the server

77
New cards

What function can be used to get a single HTML element from the page?

A)

getElementsByName()

B)

getElement()

C)

getElementByClassName()

D)

getElementById()

D

78
New cards

WebSocket is best suited for...

A)

Dynamically sending and receiving messages

B)

Putting on a sock

C)

Loading web content without refreshing

D)

Streaming multimedia content

A

79
New cards

Which statement below is false?

A)

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

B)

AJAX applications can transport data as JSON text

C)

AJAX stands for Asynchronous JavaScript And XML

D)

AJAX uses a browser built-in XMLHttpRequest object

A

80
New cards

What code is embedded in JSON.parse() ?

A)

evaluate()

B)

XMLHttpRequest.status

C)

JSON.stringify()

D)

eval()

XMLHttpRequest.status

eval()

IDK

81
New cards

What is the purpose of JSON.parse()

A) Avoid Javascript code injection

B) Ensure that the Ajax response in "valid" JSON

C) Convert JSON text string into a JavaScript object

D) All of the above

D) All of the above

A) Avoid Javascript code injection

B) Ensure that the Ajax response in "valid" JSON

C) Convert JSON text string into a JavaScript object

82
New cards

Why does AJAX exist?

A)

To reload part of a page without refreshing the entire page.

B)

To asynchronously send data to the server to validate information.

C)

Both A and B

D)

Neither A nor B

C (A and B)

83
New cards

What are solutions to the cross-domain issue for resources such as JavaScript of JSON?

A)

Use a server "proxy"

B)

Use CORS, if available

C)

Access exclusively resources in the same domain

D)

All of the above

D) All of the above

84
New cards

CORs allows fonts to be retrieved cross domain

True

85
New cards

Docker ...

A)

Allows developers to easily deploy their applications in a sandbox

B)

Allows users to package an application with all its dependencies into customized units

C)

Maximizes software packaging

D)

All of the above

A

86
New cards

Docker:

All of the above

Decouples software from underlying host

Allow extremely higher efficient sharing of resources

Has security issues

87
New cards

The Docker Ecosystem includes:

- All of the above - Service discovery - Storage - build/continuous integration

88
New cards

With Virtual Machines, it is difficult to predict the size of the VM instance.

A) True

B) False

True

89
New cards

In AWS Lambda ...

A)

Functions can be triggered only from HTTP

B)

You never pay for idle time

C)

Auto-Scaling is sometimes Available

D)

All of the above

B

90
New cards

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

91
New cards

Containers ...

A)

Are lightweight

B)

When running on same host, share same Linux kernel

C)

Are portable

D)

All of the above

D

92
New cards

Which of the following is NOT an access modifier in Java?

Imported

93
New cards

A Java constructor must share the name of the class.

Always

94
New cards

Where are files stored in a computer system?

Non-volatile memory

95
New cards

What is the difference between the next() and nextLine() methods in the Scanner class?

next() reads up until the first space, whereas nextLine() reads an entire line

96
New cards

A package in Java is similar to what C++ concept?

Namespace

97
New cards

What is the motto of Java?

Write once, run anywhere.

98
New cards

How are Java objects allocated?

All Java objects are dynamically-allocated.

99
New cards

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

A capital letter

100
New cards

__________ of an object operate on the data that is part of the object or data that is passed into the method (and usually on both).

Methods