Questions
Please, write code in c++. Using iostream library A chessboard pattern is a pattern that satisfies...

Please, write code in c++. Using iostream library

A chessboard pattern is a pattern that satisfies the following conditions:

• The pattern has a rectangular shape.
• The pattern contains only the characters '.' (a dot) and 'X' (an uppercase letter X).
• No two symbols that are horizontally or vertically adjacent are the same.
• The symbol in the lower left corner of the pattern is '.' (a dot).

You are given two numbers. N is a number of rows and M is a number of columns. Write a program that generates the chessboard pattern with these dimensions, and outputs it.

Input
The first line contains two numbers N and M (1 ≤ N ≤ 50, 1 ≤ M ≤ 50) separated by a whitespace.

Output
Output should contain N lines each containing M symbols that correspond to the generated pattern. Specifically, the first character of the last row of the output represents the lower left corner (see example 1).

example:

input:

8 8

output:

X.X.X.X.
.X.X.X.X
X.X.X.X.
.X.X.X.X
X.X.X.X.
.X.X.X.X
X.X.X.X.
.X.X.X.X

In: Computer Science

Draw Data Flow Diagrams for the following system. Starting with a context diagram, draw as many...

Draw Data Flow Diagrams for the following system. Starting with a context diagram, draw as many nested DFDs as you consider necessary to represent all of the details of the system described in the following narrative. Context diagram, Level-0, and Level 1 diagrams are required. You may choose to decompose to level-2, level-3, etc., if you think it’s necessary or if you would like to challenge yourself.

Urban Life Club (ULC) is an innovative young firm that sells memberships to people who have an interest in certain products. People pay membership fees for one year and each month receive a product by mail. For example, ULC has a coffee-of-the-month club that sends members one pound of special coffee each month. ULC currently has five memberships (coffee, wine, beer, flowers, and computer games) each of which costs a different amount. When people join ULC, the customer needs to provide his/her information including the name, mailing address, phone number, e-mail address, credit card information, start date, and membership service(s) (e.g., coffee). The computer game membership operates a bit differently from the others. In this case, the member must also select the type of game (action, arcade, fantasy/ science-fiction, educational, etc.) and age level. Some customers request more products than the membership included (e.g., two pounds of coffee), in which case they will need to pay for the additional costs. ULC is planning to greatly expand the number of memberships it offers (e.g., video games, movies, toys, cheese, fruit, and vegetables) so the system needs to accommodate this future expansion.

In: Computer Science

Please, write code in c++. Using iostream and cstring library Write a function that will find...

Please, write code in c++. Using iostream and cstring library

Write a function that will find and return most recent word in the given text.
The prototype of the function have to be the following void mostRecent(char *text,char *word)
In char *word your function have to return the most recent word that occurce in the text.
Your program have to be not case-sensitive(ignore case - "Can" and "CAN" are the same words)
Also note than WORD is sequence of letters sepereated by whitespace.

Note. The program have to use pointer.

Input:
First line contains one line that is not longer than 1000 symbols with whitespaces.

Output: The most recent word in UPPER case.

example:

Input:

Can you can the can with can?

output:

CAN

In: Computer Science

Write a function treble that takes a pointer to an integer and triples its value. Note...

Write a function treble that takes a pointer to an integer and triples its value. Note that this function does not return anything. You can test it using the following example or something similar:
int i=7;
cout << "old value; i="<<i<< "-"
treble(&i);cout <<"New Value:i="<< i <<"\n";

Which prints: Old vvalue:i =7 - new value: i=21

In: Computer Science

Pick any simple game that is played on a mobile device or desktop/tablet or game console....

Pick any simple game that is played on a mobile device or desktop/tablet or game console. For this discussion you should consider the pros and cons of playing the same game using different interfaces. Select two interfaces, other than the GUI and mobile ones (e.g. tangible, wearable, and shareable) and describe how the game could be redesigned for each of these, taking into account the user group being targeted. For example, the tangible game could be designed for young children, the wearable interface for young adults, and the shareable interface for elderly people.

  1. Include the name of the game and the real life platform and interface it is available.
  2. Identify the two new interfaces you would play the game. Describe a hypothetical scenario of how the game would be played for each of the two interfaces. (Consider specific design issues that will need to be addressed. For example, for the shareable surface would it be best to have a tabletop or a wall-based surface? How will the users interact with the game features, how will interaction occur? Would you add any other rules?)
  3. Compare the pros and cons of designing the game using the two different interfaces with respect to how it is currently played.

In: Computer Science

Use any C program without using PTHREADS calculate time taken to execute program. Write same program...

Use any C program without using PTHREADS calculate time taken to execute program.

  1. Write same program of question 1 using PTHREADS. Calculate time taken to execute program.
  2. Identify data races in above program and explain why this situation occurred with an example
  3. Rewrite the code to avoid data races should use any of the THREE techniques.

critical section

mutex solution

semaphore functions

Barriers

Read-Write Locks

Run program using 1, 2, 4, and 8 threads Comparison study

Number of threads

Implementation

1

2

4

8

critical section

mutex solution

semaphore functions

Barriers

Read-Write Locks

  1. Rewrite the program using OPENMP. Run on 4 processors. Calculate time taken.
  2. At the end calculate speed up.  

In: Computer Science

Draw a Schema Diagram using the information. Signum Libri (SL) is a publishing company. SL Operations...

Draw a Schema Diagram using the information.

Signum Libri (SL) is a publishing company.

SL Operations Database will keep track of the following:

  • For each book SL publishes: a book name, genre, date of publication, and number of pages;
  • For each writer: a unique writer identifier as well as the writer’s name;
  • For each agent: a unique agent identifier as well as the agent’s name;
  • For each editor: a unique editor identifier as well as the editor’s name;
  • Each SL book is written by one writer, and each writer can write many SL books. SL will not keep track of writers who did not write a book for SL. All books written by the same writer have a different book name. However, two writers can write two different books with the same book name.
  • Each writer is represented by one agent. Each agent represents at least one writer, but can represent many.
  • Each book has one editor. Each editor edits at least one book, but can edit many books.
  • Each editor can mentor one or more other editors, but does not have to mentor any. Each editor can have at most one mentor editor, but does not have to have any

In: Computer Science

Write a C++ program that involves implementing the RSA cryptosystem. In practice for the encryption to...

Write a C++ program that involves implementing the RSA cryptosystem. In practice for the encryption to be secure and to handle larger messages you would need to utilize a class for large integers. However, for this assignment you can use built-in types to store integers, e.g., unsigned long long int. Also, rather than using the ASCII table for this assignment use BEARCATII, which restricts the characters to the blank character and the lower-case letters of the alphabet as follows: blank character is assigned the value 0. A, …, Z are assigned the values 1, …, 26, respectively. The message M will be represented by replacing each character in the message with its assigned integer base 27. For example, the message M = “TEST” will be represented as N = 20 5 19 20 Translating this to decimal we obtain: D = 20 + 19*27 + 5*272 + 20*273 = 397838 Note that to convert back to base 27, we simply apply the algorithm we discussed in class, i.e., the least significant digit (rightmost) is obtained by performing the operations D mod 27 and performing a recursive call with D/27. For the example above we obtain, 397838 / 27, 397838 mod 27 = 14734, 20 → 14734 / 27, 14734 mod 27, 20 = 545, 19, 20 → 545/27, 545 mod 20, 19, 20 = 20, 5, 19, 20 = N Find primes p and q by choosing positive integers at random and testing for primality using Miller-Rabin probabilistic algorithm. Your program should prompt the user to input a positive integer representing the public key e. If the user enters a number that is not relatively prime to n = pq, then have the user reenter and keep doing this until e and n are coprime, i.e., gcd(e,φ(n)) = 1. Also prompt the user to enter the message M (as a character string). For handing purposes, run your program with M = “TEST”. Output p, q, n, M, C, P where C is the encrypted message, i.e., cyber text, and P is the decrypted message, i.e., plaintext. If your program is working correctly then M should be equal to P.

In: Computer Science

Laboratory Tasks public class LinkedList {              Node head;               class Node {    &nbsp

Laboratory Tasks

public class LinkedList {

             Node head;

              class Node {  

                    int data;

                    Node next;

                    Node(int d) {

                            data = d;

                            next = null;

                    }

                }

}

Complete the above java program by adding the following methods:

Part1:

  1. isEmpty() checks if the linked list is empty or not. (return type is boolean)
  2. printList() prints all data in the linked list. (void method)
  3. insertFirst(int newData) add newData at the head of the linked list. (void method)
  4. insertLasL(int newData) add newData at the tail of the linked list. (void method)
  5. findMiddle() finds the middle element in the list and displays its value. (void method)
  6. deleteFirst() deletes the first element of the list. (void method)
  7. sizeList() returns the number of elements in the list. (return type is int)
  8. Main method that calls all the previous seven methods.

In: Computer Science

Convert this C++ code to Java code this code is to encrypt and decrypt strings of...

Convert this C++ code to Java code

this code is to encrypt and decrypt strings of characters using Caesar cipher

please attach samples run of the code

#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string>

#define MAX_SIZE 200

void encrypt_str(char xyz[], int key); // Function prototype for the function to encrypt the input string.
void decrypt_str(char xyz[], int key); // Function prototype for the function to decrypt the encrypted string.

using namespace std;

int main()
{
char input_str[MAX_SIZE];
int shift = 6; // This is the Caesar encryption key... You can change it to whatever value you wish!

system("cls"); // System call to clear the console screen!


cout<<"\nEnter the string to be encrypted :\t";
gets(input_str); // Getting the user to input the string to be encrypted!

cout<<"\nOriginal string:\t" << input_str;

// Function call to encrypt the input string
encrypt_str(input_str, shift);

return 0;
}


// Function Definition for the function to encrypt the input string


void encrypt_str(char xyz[], int key){
char crypted_str[MAX_SIZE]; // To store the resulting string
int k=0; // For indexing purpose
char str;

while(xyz[k] !='\0') // Processing each character of the string until the "end of line" character is met
{
str = toupper(xyz[k]); // Remove "toupper" from this line if you don't wish to see the
// result string in Uppercase...
if(str != ' ') str += key;
{
if(str > 'z') str -=26;
{
crypted_str[k] = str;
k++;
}
}
}
crypted_str[k]='\0';
cout << "\nEncrypted string is:\t" << crypted_str; // Displaying the Crypted String

// Function call to decrypt the encrypted string
decrypt_str(crypted_str, key);
}

// Function Definition for the function to decrypt the encrypted string.
void decrypt_str(char xyz[], int key){
char decrypted_str[MAX_SIZE];
char str;
int k=0;
while(xyz[k] !='\0')
{
str = xyz[k];
if(str != ' ') str -= key;
{
if(str < 'A' && str !=' ') str += 26;
{
decrypted_str[k] = str;
k++;
}
}
}
decrypted_str[k]='\0';
cout << "\n Decrypted string is:\t" << decrypted_str;
}

In: Computer Science

Write a program that performs a merge-sort algorithm without using a recursion. Only using pointers. C++...

Write a program that performs a merge-sort algorithm without using a recursion. Only using pointers.
C++ programming language; #include<iostream>

In: Computer Science

3. Public Key Cryptography involves the use of two keys: a public key and a private...

3. Public Key Cryptography involves the use of two keys: a public key and a private key. Explain the use of each key

In: Computer Science

Programing language C++ In this exercise you will explore the performance difference between sequential search and...

Programing language C++

In this exercise you will explore the performance difference between sequential search and binary search. To do so write a program that performs the following tasks:

Prompt the user for a file containing 100,000 unsorted integers

Read those integers into an array

Prompt the user for a search item

Search for that item (using sequential search) and report the number of comparisons required.

Sort the array. Note that this might take a few minutes.

Search for that item again (using binary search) and report the number of comparisons required.

You will need to modify both of the search functions to report the number of comparisons that were made during the search.

Use your program and the file of 100,000 integers provided here to answer the six questions in the quiz.

In: Computer Science

Activity 3: How does injection attack occur? (30 minutes) Assume the web server includes the following...

Activity 3: How does injection attack occur? (30 minutes)

Assume the web server includes the following code

sqlString = “select USERID from USER where USERID = ` $userId ` and PWD = ` $password `”

result = GetQueryResult(sqlString)

if(result = “”) then

     userHasBeenAuthenticated = False

else

     userHasBeenAuthenticated = True

end if

Here, $userId and $password are the values submitted by the user, and the query statement provides the quotation marks that set it as a literal string.

Critical Thinking Question

  1. If a user enters UTC as userId and chattanooga’ as password, what is the constructed SQL statement which is also the value of sqlString from the above code?
  1. Will the constructed SQL be executed? Why and Why not?

  1. After enter UTC as userId and chattanooga’ you may observe different system responses: a) the SQL parser find the extra quote mark and aborts with a syntax error and return server error, or b) email address is unknown or We don't recognize your email address. This distinction will be very useful when trying to guess the structure of the query. Which one means that user input is not being sanitized properly and that the application is ripe for exploitation?
  1. What is the resulting SQL query statement if a user enters User ID as ` OR ``=` and Password as `OR ``=`? What is the result of this query or what is the value of sqlString? Does this input allow user to log in? And why or Why not?
  1. What is the resulting SQL query statement if a user enters User ID as ` OR ``=`` -- and Password as abc? What is the result of this query or what is the value of sqlString? Does this input allow user to log in? And why or Why not?

  1. Explain why the case in question 7 and 8 construct injection attacks.

In: Computer Science

Activity 2: Injection Basics Injection attacks trick an application into including unintended commands in the data...

Activity 2: Injection Basics Injection attacks trick an application into including unintended commands in the data send to an interpreter.

Interpreters Interpret strings as commands such as SQL, shell (cmd.exe, bash)

Critical Thinking Questions: 1. What does a user/attacker see at the webpage? Where can an attacker enter exploit data/input? 2. Which entity builds user string input and send SQL query to Database server? 3. Which entity executes query including exploit and send back to web server and then user?  

In: Computer Science