Questions
How does Linux share printers differently than Windows?

How does Linux share printers differently than Windows?

In: Computer Science

Can the following code be modified to use a mutex lock rather than a semaphore? Why...

Can the following code be modified to use a mutex lock rather than a semaphore? Why or why not? (sem_post() is the POSIX form of signal())

sem_t sem;

sem_init(&sem, 0, 1);

sem_wait(&sem);

// critical section

sem_post(&sem);

sem_destroy(&sem);

In: Computer Science

Consider this code: "int v = 20; --v; System.out.println(v++);". What value is printed, what value is...

Consider this code: "int v = 20; --v; System.out.println(v++);". What value is printed, what value is v left with?

20 is printed, v ends up with 19
19 is printed, v ends up with 20
20 is printed, v ends up with 20
19 is printed, v ends up with 19
cannot determine what is printed, v ends up with 20

In: Computer Science

Hi, These question is about flooding attack. I need more detail about it. Provide at least...

Hi, These question is about flooding attack. I need more detail about it.

  1. Provide at least two technology alternatives for addressing the security topic chosen by the team. For each potential technology considered, provide an overview of its operation, availability, cost, implementation issues, and overall benefit to the end-user.
  2. Perform an analysis of the candidate technologies. This analysis should include both qualitative and quantitative techniques. Based upon your analysis, select a suitable solution and justify your selection.

In: Computer Science

Write program that pass unsorted one dimensional array and a key to function, the function will...

Write program that pass unsorted one dimensional array and a key to function,
the function will search for the key(using linear search) and if it is found the
function will sort the array from the beginning to the position of the key, and f
it is not found the function will sort all the array
Note: please solve it by c , not c++

In: Computer Science

A good strategy to manage the memory consumed by an array-based implementation of ListInterface is Group...

A good strategy to manage the memory consumed by an array-based implementation of ListInterface is

Group of answer choices

to quadruple the size of the array when it is full and to cut it to one quarter when it is one quarter full

to double the size of the array when it is full and to cut it to half when it is half full

to triple the size of the array when it is full and to cut it to half when it is half full

to double the size of the array when it is full and to cut it to 3/4 when it is one half full

All of the above

When removeGap(pos) method of an array-based implementation of ListInterface is called, no entries will be moved if pos is equal to

Group of answer choices

numberOfEntries

numberOfEntries – 1

1

0

None of the above

Our AList (array-based) implementation of the List interface has an initial capacity of 25 elements. We add 101 items using the method add(). We then remove 50 items using the method remove(). Assuming that remove() doesn't change the size of the array, what is the length of the array after the last call to remove()?

Note that length of array can be different from the number of entries in the array.

Group of answer choices

50

51

75

100

200

In an array-based implementation of ListInterface, what is the time complexity of removing an entry from the end of the list when remove() doesn't change the length of the array?

Group of answer choices

O(1)

O(log n)

O(n)

O(n2)

none of the above

In: Computer Science

There are two text files, whose names are given by two String variables, file1 and file2....

There are two text files, whose names are given by two String variables, file1 and file2. These text files have the same number of lines. Write a sequence of statements that creates a new file whose name consists concatenating the names of the two text files (with a "-" in the middle) and whose contents of merging the lines of the two files. Thus, in the new file, the first line is the first line from the first file, the second line is the first line from the second file. The third line in the new file is the second line in the first file and the fourth line is the second line from the second file, and so on. When finished, make sure that the data written to the new file has been flushed from its buffer and that any system resources used during the course of running your code have been released.(Do not concern yourself with any possible exceptions here-- assume they are handled elsewhere.)

In: Computer Science

Write program to store ten integers in an array and the program will do the following...

Write program to store ten integers in an array and the program will do the
following
Find the average of even marks

Find how many prime integers inserted
Note: please solve it by c , not c++

In: Computer Science

I'm having trouble programming connect four board game using linked lists in c++. Can you code...

I'm having trouble programming connect four board game using linked lists in c++. Can you code connect four game using linked lists.

In: Computer Science

Consider a linked list whose nodes are objects of the class Node: class Node {    ...

Consider a linked list whose nodes are objects of the class Node:

class Node {
    public int data;
    public Node next;

}


prev references a node n1 in the list and curr references the node n2 that is right after n1 in the list. Which of the following statements is used to insert a new node, referenced by newNodebetween prev and curr?

Group of answer choices

newNode.next = curr;
prev.next = newNode;

newNode.next = head;
head = newNode;

prev.next = newNode;
newNode.next = prev;

prev.next = curr;
newNode.next = curr;

none of the above

Which of the following statements deletes the first node of a linked list implementation of ListInterface that has 10 nodes? Assume curr refers to the second node in the list and the head of the list is the reference variable fistNode

Group of answer choices

A. firstNode.next = curr.next;

B. firstNode = curr.next;

C. firstNode = firstNode.next;

D. curr = firstNode.next;

E. B and C

In LList2 implementation of the ListInterface,

Group of answer choices

A. The worst-case runtime of contains() is independent of the number of items in LinkedList

B. The runtime of getLength() is independent of the number of items in LinkedList

C. The runtime of remove(1) (removing the first element) is independent of the number of items in LinkedList

D. A and B

E. B and C

In a linked implementation of ListInterface, if the reference to the first node is null, this means

Group of answer choices

the list is full

the garbage collector should be invoked

we can't add items to the list

the list is in an unstable state

the list is empty

In: Computer Science

C++ 1. Write a function decimalToBinary() that takes in a positive integer as a parameter and...

C++

1. Write a function decimalToBinary() that takes in a positive integer as a parameter and use as stack to convert the integer to a its corresponding binary representation. Hint: divide the integer by 2.

2. A palindrome is a string of characters (a word, phrase, or sentence) that is the same regardless of whether you read it forward or backward—assuming that you ignore spaces, punctuation, and case. For example, Race car is a palindrome. So is A man, a plan, a canal: Panama. Write a function isPalindrome() that takes a string as a parameter and uses a stack to test whether a string is a palindrome.

3. Suppose that you read a binary string—that is, a string of 0s and 1s—one character at a time. Write a function that use a stack but no arithmetic to see whether the number of 0s is equal to the number of 1s. When these counts are not equal, show which character—0 or 1—occurs most frequently and by how much its count exceeds the other’s.

4. Write a program to test the four functions above.

In: Computer Science

Assume, you are trying to execute the following jobs with execution times and their varying arrival...

Assume, you are trying to execute the following jobs with execution times and their varying arrival times are given. These jobs are run on a single processor using pre-emptive SJF algorithm. If the average waiting time of the processes is 4 millisecond, then the value of X is________. Show the equation with values that helps you to find the value of X.

Process No: J1 J2 J3 J4 J5 J6

Arrival time: 0 1 2 3 4 5

Burst Time: 7 5 3 1 2 X

In: Computer Science

in java: Write a class responsible for storing data in a text file. The class should...

in java:

Write a class responsible for storing data in a text file.  The class
should include a method that accepts a string and appends it to a file.

In: Computer Science

How many moves are required to solve the Towers of Hanoi problem when we have 3...

How many moves are required to solve the Towers of Hanoi problem when we have 3 disks?

Group of answer choices

5

6

8

4

7

After the following statements execute, what item is at the front of the queue?


QueueInterface<String> zooDelivery = new LinkedQueue<>();
zooDelivery.enqueue("lion");
zooDelivery.enqueue("tiger");
zooDelivery.enqueue("cheetah");
String next = zooDelivery.dequeue();
next = zooDelivery.dequeue();
zooDelivery.enqueue("jaguar");
zooDelivery.enqueue("cat");

Group of answer choices

"lion"

"tiger"

"cheetah"

"jaguar"

"cat"

When a recursive method does not include a base case, calling the method results in

Group of answer choices

A. iterative recursion

B. stack overflow

C. infinite recursion

D. A and B

E. B and C

In StackInterface, the method pop()

Group of answer choices

removes and returns the item that was pushed last on the stack

returns the item that was pushed last on the stack but does not remove it

removes and returns the item that was pushed first on the stack

returns the item that was pushed first on the stack but does not remove it

None of the above

In: Computer Science

C++ 14.11 Lab # Map Write a menu driven program to perform following operations using a...

C++ 14.11 Lab # Map

Write a menu driven program to perform following operations using a map container that stores the information about USA Population (In Million).

@@@Menu@@@
1. Add Information
2. Display Information
3. Update Information
4. Erase Information
5. Clear Information

For example, Suppose the map initially contains following information (Use emplace() function to store the information)
2010, 309.33
2011, 311.58
2012, 313.87
2015, 320.74
2016, 323.07

The program should produce the desired output when a valid input is provided, as follows:

1. If the Input is:
1
2018
329.16
The output should be:
Record Added: USA population in 2018 is 329.16 Million.

2. If the Input is:
2
2015
The output should be:
USA population in 2015 is 320.75 Million.

3. If the Input is:
3
2015
321.88

The output should be:
Record Updated: USA population in 2015 is 321.88 Million.

4. If the Input is:
4
2015

The output should be:
Record Deleted: USA population in 2015 was 321.88.

5. If the Input is:
5

The output should be:
All records Deleted.

In: Computer Science