Questions
Try to make it as simple as you can and explain as much as it needed....

Try to make it as simple as you can and explain as much as it needed.

  1. What are the differences between symmetric encryption and asymmetric encryption? (1 point)

Ans:

  1. What is pseudo random numbers? (1 point)

Ans:

  1. What is Moore’s Law? (1 point)

Ans:

  1. What are four different block cipher modes? (1 point)

Ans:

  1. What is one-time pad? (1 point)

Ans:

In: Computer Science

This is a java coding String manipulation Question. Let us say I have a String which...

This is a java coding String manipulation Question.

Let us say I have a String which looks something likes this:

String x = "MATH,PHYSICS,CHEMISTRY,CODING"

And then I have another String which looks something like this:

String y = "XXXXMXXXAXXXTXXXXHXXXXXXCXXXXOXXXXDXXXIXXXXNXXXGXXXX"

and another String that looks like this:

String z = "XXXXHXXTXXXXAXXMXXXXXCXXXOXXXDXXXIXXXNXXXG"

I want to take String y and print the words that are found in String x as such:

Math

Coding

and for String z if I want to take it and print the words also found in x as such:

Math

Coding

So basically I want to the program to print the possible words from the letters I have in String y and z.

and only print possible words from my String x.

I want to know how I can do such thing please explain so that I understand what is going on. I have tried replacing the Xs with nothing and then I would have the letters and then I'll use it to check if it has something in String x. but that made me use arrays and also if I replaced Xs with nothing and I had to words in Z or Y then I'll end up with something I can not work with only letters.

I have also thought about making a char array from the resulting String after replacing Xs. and then split String x by ',' and after make a char array of each word and then check if the char array of each word contains the chars of the resulting String after replacing Xs with nothing.

but that also does not work.

I think this is a simple problem that I am over complicating.

Please help and thank you.

In: Computer Science

Explain any android application in detail and on your own words it should include the purpose,...

Explain any android application in detail and on your own words

it should include the purpose, security features and you suggest to improve it

In: Computer Science

Given that Sale[NUM_ROW][NUM_COLUMN] is a two dimensional array of float- point type and the two constants...

Given that Sale[NUM_ROW][NUM_COLUMN] is a two dimensional array of float-

point type and the two constants are defined as follows:

#define NUM_ROW 4

#define NUM_COLUMN 4

float Value[NUM_ROW][NUM_COLUMN] =

{

2.1, 2.2, 2.3, 2.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.1, 2.2, 2.3, 2.4

};

Write a C++ main function that computes and prints out the following information about

this 2d array:

(1) The mean of all the Value[][] array elements (0.5 points).

(2) The median of all the Value[][] array elements (0.5 points)

(3) The local average values of all the array elements (1.0 points). For instance, the

local average value at position i, j = (Value[i-1][j]+Value[i+1][j]+Value[i][j+1]+Value[i][j-1]+Value[i][j])/5.

If (i+1) > NUM_ROW-1 or (i-1) < 0, use modulus operator to wrap around to the other end of the array index.

Create another array: Average[NUM_ROW][NUM_COLUMN], and use this array to store the values

of local average at each position of this 2d array. At the end, you need print out

the values of all the array elements of Average[][] on computer screen.

Parts (2) only please.

In: Computer Science

Create a website for an online movie rental store, using HTML (and any other client technologies)...

Create a website for an online movie rental store, using HTML (and any other client technologies) and PHP. The website should include:

- A front/home page containing a list of movies available for rent (list at least 10 movies).

o Each movie should have a listed rental price.

o Additional information provided:

§ name of actors in the movie (list at least 2)

- The home page should link to a form for renting a movie

o Selecting and submitting a movie for rent will lead to a page displaying

§ the name of the movie rented,

§ the amount charged (calculated with 5% tax),

§ the date and time rented, and § the date and time the movie is due for return (in 5 days).

- A form linked through the home page for selecting a movie and submitting a user review.

o Input fields should include

§ The name of the movie

§ Username

§ Rating in 5 stars

§ User review

o Output after submitting a review should show the name of the movie and all submitted information.

In: Computer Science

Try to make it as simple as you can and explain as much as it needed....

Try to make it as simple as you can and explain as much as it needed.

  1. What are the differences between symmetric encryption and asymmetric encryption? (1 point)

Ans:

  1. What is pseudo random numbers? (1 point)

Ans:

  1. What is Moore’s Law? (1 point)

Ans:

  1. What are four different block cipher modes? (1 point)

Ans:

  1. What is one-time pad? (1 point)

Ans:

In: Computer Science

Try to make it as simple as you can and explain as much as it needed....

Try to make it as simple as you can and explain as much as it needed.

  1. Define Integrity and Nonrepudiation? (2 points)

Ans:

  1. What are the differences between Stream Cipher and Block Cipher? (2 points)

Ans:

  1. What is Access Control and why is it important? (2 points)

Ans:

  1. Message Authentication Code ensures authentication or integrity or both? Justify and explain your answer. (3 points)

Ans:

  1. What are the weaknesses of DES? Why triple DES is better than Double DES? (3 points)

Ans:

In: Computer Science

This problem should be solved using the DrRacket software in Racket/Scheme language. Write a function (merge-sorter...

This problem should be solved using the DrRacket software in Racket/Scheme language.

Write a function (merge-sorter L1) that takes list-of-integers L1 and returns all elements of L1 in sorted order. You must use a merge-sort technique that, in the recursive case, a) splits L1 into two approximately-equal-length lists, b) sorts those lists, and then c) merges the lists to obtain the result. See the following examples for clarificaton.

(merge-sorter '(3 1 5 4 2) ---> (1 2 3 4 5)
(merge-sorter '()) ---> ()
(merge-sorter '(1)) ---> (1)

In: Computer Science

Q: Let’s say you have an unordered list of numbers and you wanted to put them...

Q: Let’s say you have an unordered list of numbers and you wanted to put them in order from lowest to highest value. How would you do that? You’re probably thinking that you would just look at all the numbers, find the lowest number and put it at the beginning of your list. Then you would find the next largest number and put it in the second spot in the list, and so on until you’ve ordered the entire list of numbers. It’s simple, basic, and not very exciting. Now, let’s say that instead of ordering the list yourself, you decide it’s a better idea to write a computer program to order the list for you. Now you don’t have to deal with moving the numbers around, you just need to tell your program how to move the numbers, and then let the program handle any list you give it.Identify all possible ways of telling your program how to move the numbers, where each way provides the required result.

(Note: The program code is preferred to be in Java)

In: Computer Science

Download labSerialization.zip and unzip it: ListVsSetDemo.java: package labSerialization; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List;...

Download labSerialization.zip and unzip it:

ListVsSetDemo.java:

package labSerialization;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
* Demonstrates the different behavior of lists and sets.
* Author(s): Starter Code
*/
public class ListVsSetDemo {
private final List<ColoredSquare> list;
private final Set<ColoredSquare> set;

/**
* Initializes the fields list and set with the elements provided.
*
* @param elements
*/
public ListVsSetDemo(ColoredSquare... elements) {
list = new ArrayList<>(Arrays.asList(elements));
set = new HashSet<>(Arrays.asList(elements));
}

/**
* Creates a string that includes all the list elements.
* Each element is followed by a new-line.
*
* @return string of list elements
*/
public String getListElements() {
StringBuilder sb = new StringBuilder();
for (ColoredSquare el : list) {
sb.append(el).append("\n");
}
return sb.toString();
}

/**
* Creates a string that includes all the elements in the set.
* Each element is followed by a new-line.
*
* @return string of set elements
*/
public String getSetElements() {
StringBuilder sb = new StringBuilder();
for (ColoredSquare el : set) {
sb.append(el).append("\n");
}
return sb.toString();
}

/**
* Adds the element <code>el</code> to both the list and the set.
*
* @param el
*/
public void addElement(ColoredSquare el) {
list.add(el);
set.add(el);
}
}

ColoredSquare.java:

package labSerialization;

import java.awt.Color;

/**
* A square that is defined by its size and color.
* Author(s): Starter Code
*/
public class ColoredSquare {
private final int side;
private final Color color;

/**
* Initializes the fields <code>side</code> and <code>color</code>.
* @param s the side length of the square
* @param c the color of the square
*/
public ColoredSquare(int s, Color c) {
side = s;
color = c;
}

/**
* Calculates the area of the square.
*/
public int area() {
return side * side;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((color == null) ? 0 : color.hashCode());
result = prime * result + side;
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof ColoredSquare))
return false;
ColoredSquare other = (ColoredSquare) obj;
if (color == null) {
if (other.color != null)
return false;
} else if (!color.equals(other.color))
return false;
if (side != other.side)
return false;
return true;
}

@Override
public String toString() {
return String.format("side:%d #%02X%02X%02X",
side, color.getRed(), color.getGreen(),
color.getBlue());

}

}

LabSerialization.java:

package labSerialization;

import java.awt.Color;

/**
* LabSerialization demonstrates how to serialize and deserialize
* a custom object that references other objects on the heap.
* Author(s): Starter Code + ........... // fill in your name
*/
public class LabSerialization {
public static void main(String[] args) {
ListVsSetDemo demo = new ListVsSetDemo(
new ColoredSquare(4, Color.RED),
new ColoredSquare(6, Color.BLUE),
new ColoredSquare(4, Color.RED),
new ColoredSquare(8, Color.YELLOW));

displayListAndSet(demo);

};

/**
* Displays the elements of the list and the set.
*/
private static void displayListAndSet(ListVsSetDemo demo) {
System.out.println("List:");
System.out.println(demo.getListElements());
System.out.println("Set:");
System.out.println(demo.getSetElements());
}

}

  • Open the Java project 1410_LABS and drag the unzipped folder (package) labSerialization into the src folder. You might be asked whether the files should be copied or linked. Select "Copy files and folders".
    Run the program. You should get an output similar to this.
    Notice how the list includes two squares of size four but there are no duplicates in the set.
  • In class ListVsSetDemo

    • Implement the interface Serializable from package java.io
    • Notice the warning from Eclipse: have Eclipse auto-generate a serialVersionUID
      Right-click the yellow warning icon > Quick Fix > Add Generated Serial Version ID
      A private static final field of type long is added
  • In class ColoredSquare:

    • Implement interface Serializable.
      All classes whose objects are serialized need to implement the interface Serializable. We don't serialize ColoredSquare explicitly. However, objects of type ColoredSquare are used in ListVsSetDemo. That's why we need to implement the interface Serializable for class ColoredSquare as well.
    • Have Eclipse auto-generate a serialVersionUID
  • In class LabSerialization:

    • Add a method called serialize.
      It has no return value and two parameters: demo of type ListVsSetDemo and filename of type String
      • Use a try-with-resource statement when serializing the ListVsSetDemo instance.
        Save the serialized object in the specified file.
      • In case of an exception, print the message provided by the exception object.
    • In the main method comment out the method call
      displayListAndSet(demo);
      Call the method serialize. As filename pass a relative path that creates the file Demo.ser in the directory labSerialization.
      Print a brief message to let the user know that serialization is complete.
      Run the program and verify that the instance got serialized and that the file got created.
    • Add a method called deserialize.
      It returns a ListVsSetDemo and has one parameter: a filename of type String
      • Use a try-with-resource statement to implement the deserialize method
      • Use a single catch block to catch both IOExceptions and FileNotFoundExceptions
    • In main call the method deserialize.
      Assign the ListVsSetDemo returned to a new variable called newDemo and pass it to the method displayListAndSet

Sample Output

This sample output should give you a good idea of what is expected. Note though, that the elements in HashSet are in no particular order. Because of that, the second part of the output might look slightly different.

Sample Output

List:
side:4 #FF0000
side:6 #0000FF
side:4 #FF0000
side:8 #FFFF00

Set:
side:6 #0000FF
side:8 #FFFF00
side:4 #FF0000

In: Computer Science

This problem should be solved using the DrRacket software in the Racket/Scheme language. Consider two techniques...

This problem should be solved using the DrRacket software in the Racket/Scheme language.

Consider two techniques for representing a graph as Scheme lists. We can represent a directed graph as a list of edges. We call this representation an el-graph (i.e. edge-list graph). An edge is itself a list of length two such that the first element is a symbol denoting the source of the edge and the second element is a symbol denoting the target of the edge. Note that an edge is a list (not just a pair). For example, the following is a graph: '((x y) (y z) (x z)). We can also represent a graph similar to an adjacency matrix. We call this representation an x-graph (i.e. matrix-graph). In this case, a graph is a list of adjacencies where an adjacency is a list of length two such that the first element is a node (a symbol) and the second element is a list of the targets of that node. For example, the following is a graph: '((x (y z)) (y (z)) (z ())).

- Write function (el-graph->x-graph g), that accepts an el-graph g and returns an x-graph of g.

- Write function (x-graph->el-graph g), that accepts an x-graph g and returns an el-graph of g.

In: Computer Science

Question 1 [multiple answer] a relation in mathematics Is much like a database table except that...

Question 1

[multiple answer] a relation in mathematics

  1. Is much like a database table except that relations are sets, i.e. Don't allow duplicates whereas DBMSs may return tables with duplicates
  2. Is not very much like a database table, because it only refers to such expressions as "greater than"
  3. Is like a database table with exactly two columns, no more and no fewer
  4. Is similar to a database table, but database tables cannot have infinitely many rows

Question 2

[multiple answers] in the relational model, relations are commonly used

  1. To represent entities of the ER model
  2. To represent relationships of the ER model
  3. To represent multi-valued attributes
  4. To represent derived attributes

Question 3

[multiple answers] constraints on relations in normal RDBMSs (not considering MS access)

  1. Are tools for querying tables
  2. Are tools for aiding data quality
  3. Are tools for improving security
  4. Are tools for filtering out records that should not get inserted

Question 4

[multiple answers] which of the following constraints can be violated by inserting a record into a database table?

  1. Primary key constraint
  2. Domain constraint
  3. Referential integrity (foreign key) constraint
  4. Constraint on null

Question 5

[multiple answers] which of the following constraints can be violated through a deletion of a record from a database table?

  1. Primary key constraint
  2. Domain constraint
  3. Referential integrity (foreign key) constraint
  4. Constraint on null

Question 6

[multiple answers] assume a table A with primary key aid, and a table B with primary key bid and foreign key aid which references aid in table A. Which of the following operations can result in a violation of the referential integrity (foreign key) constraint?

  1. Insertion of a record into table A
  2. Insertion of a record into table B
  3. Deletion of a record from table A
  4. Deletion of a record from table B

Question 7

[multiple answers] referentially triggered actions

  1. May happen as a result of a deletion of a record because its primary key value is referenced by a foreign key value in a different relation
  2. May happen as a result of a deletion of a record because it has a foreign key value that references a primary key value in a different relation
  3. Are typically the result of defining a trigger for enforcing semantic integrity constraints
  4. May happen as a result of an insertion of a record that defines a foreign key value for which no primary key value exists in a referenced table

Question 8

[multiple answers] a 1-to-1 relationship in the entity-relationship model can be represented in the relational model

  1. By combining the two entities into one table
  2. By adding a foreign key to one of the tables, which references the primary key of the other table
  3. By creating a separate table that has two foreign keys, which reference the primary keys of the two tables that represent the entities
  4. Cannot be represented at all in a relational database

Question 9

[multiple answers] a 1-to-many relationship in the entity-relationship model can be represented in the relational model

  1. By combining the two entities into one table
  2. By adding a foreign key to the table on the "many" side of the relationship, which references the primary key of the other table
  3. By adding a foreign key to the table on the "1" side of the relationship that references the primary key of the other table
  4. By creating a separate table that has two foreign keys, which reference the primary keys of the two tables that represent the entities

Question 10

[multiple answers] a many-to-many relationship in the entity-relationship model can be represented in the relational model

  1. By combining the two entities into one table
  2. By adding a foreign key to one of the tables, which references the primary key of the other table
  3. By creating a separate table that has two foreign keys, which reference the primary keys of the two relations that represent the entities
  4. Cannot be represented at all in a relational database

In: Computer Science

This was my prompt, and I'm not quire sure what to do. 1. Circle: Implement a...

This was my prompt, and I'm not quire sure what to do.

1. Circle:

Implement a Java class with the name Circle. It should be in the package edu.gcccd.csis.

The class has two private instance variables: radius (of the type double) and color (of the type String).

The class also has a private static variable: numOfCircles (of the type long) which at all times will keep track of the number of Circle objects that were instantiated.

Construction:

A constructor that constructs a circle with the given color and sets the radius to a default value of 1.0.

A constructor that constructs a circle with the given, radius and color.

Once constructed, the value of the radius must be immutable (cannot be allowed to be modified)

Behaviors:

Accessor and Mutator aka Getter and Setter for the color attribute

Accessor for the radius.

getArea() and getCircumference() methods, hat return the area and circumference of this Circle in double.

Hint: use Math.PI (https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#PI (Links to an external site.))

2. Rectangle:

Implement a Java class with the name Rectangle. It should be in the package edu.gcccd.csis.

The class has two private instance variables: width and height (of the type double)

The class also has a private static variable: numOfRectangles (of the type long) which at all times will keep track of the number of Rectangle objects that were instantiated.

Construction:

A constructor that constructs a Rectangle with the given width and height.

A default constructor.

Behaviors:

Accessor and Mutator aka Getter and Setter for both member variables.

getArea() and getCircumference() methods, that return the area and circumference of this Rectangle in double.

a boolean method isSquare(), that returns true is this Rectangle is a square.

Hint: read the first 10 pages of Chapter 5 in your text.

3. Container

Implement a Java class with the name Container. It should be in the package edu.gcccd.csis.

The class has two private instance variables: rectangle of type Rectangle and circle of type Circle.

Construction:

No explicit constructors.

Behaviors:

Accessor and Mutator aka Getter and Setter for both member variables.

an integer method size(), that returns 0, if all member variables are null, 1 either of the two member variables contains a value other than null, and 2, if both, the rectangle and circle contain values other than null.

In: Computer Science

I want to make the Main function of this program to only drive. So, make more...

I want to make the Main function of this program to only drive. So, make more functions, and change main function to just drive.

This program Dice Game.

Based on this C++ program below:

#include <iostream>
#include <cstdlib>

using namespace std;

int cheater(int computer, int user){
   cout<<"Using cheat"<<endl;
   if(computer>user)return computer+rand()%2;
   if(computer==3 || computer==18)return computer;
   if(user>computer)return computer -1;
}

int main()
{
int user, computer,sum,u_diff,c_diff,u_win=0,c_win=0;
int gameCount=0;
bool enableCheat=false;
int lastGameWon=0;
do
{
cout<<"User guess is(1 - 18) :";
cin>>user;
if(user>=3&&user<=18) //the sum of three dice should be between 3 to 18
{
   gameCount+=1;
cout<<"Computer guess is :";
computer=rand()%16+3;
cout<<computer<<endl<<"User guess is : "<<user<<endl;
cout<<"Sum of the three rolls is :";
sum=rand()%16+3; //rand()%16 will generate the random number between 0 to 15.
if(enableCheat)sum=cheater(computer,user);
cout<<sum<<endl;
u_diff=user-sum;
c_diff=computer-sum;
if(u_diff<0){
u_diff=u_diff* -1; //u_diff,c_diff is the diffence and it should always be positive.
}
if(c_diff<0){
c_diff*=c_diff* -1; //if u_diff or c_diff is negetive than we make it positive.
}
if(u_diff<c_diff){

cout<<"user won\n";
u_win++;
if(lastGameWon+1==gameCount)enableCheat=true;
lastGameWon=gameCount;
} else{
cout<<"computer won\n";
c_win++;
enableCheat=false;
}
cout<<"User won: "<<u_win<<" times.";
}else if(user >= 19 || user <= 0){
cout<<"please enter between 1 to 18\n";
}
}while(user!=-1);
return 0;
}

In: Computer Science

Public static boolean isPalindrome(String word) * Check to see if a word is a palindrome. Should...

Public static boolean isPalindrome(String word)
* Check to see if a word is a palindrome. Should be case-independent.
* @param word a String without whitespace
* @return true if the word is a palindrome
  

Public static int longestWordLength(String words)

* Returns length of the longest word in the given String using recursion (no loops).
* Hint: a Scanner may be helpful for finding word boundaries. After delimiting by space,
* use the following method on your String to remove punctuation {@code .replaceAll("[^a-zA-Z]", "")}
* If you use a Scanner, you will need a helper method to do the recursion on the Scanner object.
* @param words A String containing one or more words.
* @return The length of the longest word in the String.
* @see Scanner#Scanner(String)
* @see Scanner#next()
* @see String#split(String)
* @see String#replaceAll(String, String)
* @see Math#max(int, int)

In: Computer Science