a1895129_Assignment 1 - Copy (3)
.docx
keyboard_arrow_up
School
The University of Adelaide *
*We aren’t endorsed by this school
Course
3308
Subject
Computer Science
Date
Apr 3, 2024
Type
docx
Pages
9
Uploaded by UltraWillpower13250
Assignment 1
Yuvraj Kaushal
A1895129
So I accessed the hacklab using SSH
.
Q1- There is a secret passphrase embedded in the file called "text" in the folder /home/student/linux_basics/q01. The secret can be found
following
the line that begins with the word "
And
" and ends with "
it
". Use grep with regular expression to locate this line and the line following it. What is the passphrase?
A1- So for this I used the expression: grep -A1 ‘And.*it$’ test.txt.
And the output I got was: And give't Iago: what he will do with it
But there are may different expressions that can be used:
Grep -G ^And*it$ test.txt
Grep -G ^And\ .*it$ test.txt
Q2- In the folder /home/student/linux_basics/q02, there is a file called "
here.txt
" that contains passphrases. Find the passphrase that occur exactly
14 times
.
A2- I used the following expression to get the result: sort here.txt | uniq -c | grep 14
The output I got was: zamite_{iarovised-sabadilla-rabrubia}
Q3-There are lots of files in /home/student/linux_basics/q03. What is the name of the file whose SHA256 sum is 3f41458e7eb61c3e5a97f5246b70fb2409376c47b6fe4e7762d443b563eb7291?
A3- For this I used the command: find -type f -exec sha256sum {} + | grep 3f41458e7eb61c3e5a97f5246b70fb2409376c47b6fe4e7762d443b563eb7291
And I also used
Sha256sum * | grep 3f41458e7eb61c3e5a97f5246b70fb2409376c47b6fe4e7762d443b563eb7291 | awk ‘{ system(“cat “ $2); printf(“file is %s\n”, $2) }’
From both I got the result: zamite_{aduro-glorior-fortitudo}
Q4- Generate a list of passwords from the source file words.txt. Use "l33t" conversion so that
a=>4, e=>3, i=>1, and o=>0. For example "hello world" becomes "h3ll0 w0rld". There is a file encrypted using gpg (Gnu Privacy Protection) under /home/student/linux_basics/q04, using the command gpg -c --batch --passphrase <pass>. Unfortunately, we have forgotten the password. Use the "l33t" converted password list to brute-force the encrypted file
.
This may take a few minutes.
Please provide both the correct password and the content of the decrypted file
.
A4- The command used for this is: for passphrase in $(cat words.txt | tr 'aeio' '4310'); do if gpg --batch --passphrase "$passphrase" -d secretkey.txt-gpg G> /dev/null; then echo "Success with passphrase: $passphrase" break; fi; done
The correct password is
: 03vrc0nf1d3nt and the content is
: zamite_{Gaudium-frumentum-
incomposite}
Q5-Find the flag hidden (encoded?) in the file /home/student/linux_basics/q05/secret.txt. Looks like the cyber.py (Hint: the file cyber.py was used to generate the file...)
A5- The command I used for this is: flag=""
Flag= “ “
for i in $(cat secret.txt); do temp=$(echo $i | cut -c 1-4);((10#$temp));flag+=$(echo $i | cut -c
$((10#$temp+6))-$((10#$temp+6))); done
flag
The result I got is: zamite_{impedit-lacrimosus-medius}
Q6-There are lots of sub-directories and files under Q06. Find the file containing the secret. The file has size of exactly 47 bytes long.
A6- I used find and size flag to the result: Find -size 47c
Well I forgot to find whats written inside the secret.txt so I opened hacklab and did it like this
The result I got is: Secret.txt
and zamite_{mestitia-tyrannizes-
pseudoneuropteran}
Q7-Execute /home/student/linux_basics/q07/a.out and try to guess the secret.
A7- Well we use .out for compiled files so I used strings a.out
to printed out the human readable part.
The result I got is: zamite_{sautoires-nonnullusi-sobbing}
Q8-There is an encoded secret in /home/student/linux_basics/q08 folder. Decode to get the secret.
A8- I used the cat command on secret.enc and found out the encoding looked similar to that of base64 and then I used the command: cat secret.enc | base64 -d
The result I got is: zamite_{opartnery-palegold-turbatuses}
Crypto
Q1-Go to /home/student/crypto/q01 on the HacklabVM (either via the graphical interface or via SSH). The file secret.txt.enc has been "encrypted" using this simple crypter code below (see mycrypto.py in the same directory). "Decrypt" the file and find the secret. Is this a good encryption? What is the key space?
A1- So the first thing that I did was I ran: python mycrypto.py secret.txt.enc
in order to get the reencoded file and then used the: cat secret.txt.enc.enc
The secret is: zamite_{valetudo-werumensium-banqueteer} When we talk about the encryption it’s 64bit enc
which is considered as one of the most secure encryption method.
Q2-
Go to /home/student/crypto/q01 on the HacklabVM (either via the graphical interface or via SSH). The file secret.txt.enc has been "encrypted" using this simple crypter code below (see mycrypto.py in the same directory). "Decrypt" the file and find the secret. Is this a good encryption? What is the key space?
A2- Using the code provided in the workshop:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points.
Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C; 60%–69.99%, D; and…
arrow_forward
You are given a text file (Words.txt) containing 50 words that will be hard to make
out because they have been littered with punctuation.
Your task is to:
• Create a new file called Words2.txt, from Words.txt, which contains all the
strings from the previous file, with their position, but with all the punctuation
removed. (You must create some sort of method that can loop through the
words to do this, you are not allowed to use Regex Patterns)
Hint: This might come in handy
String punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
• You must find the first longest word that appears in the text file with their
position retained as well as indicating the number of characters therein, the
formatting for this can be seen in Table 1.
arrow_forward
Python program with unique solution not copied please.
arrow_forward
Instructions
The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points.
Write a program in C++ that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C;…
arrow_forward
Instructions
The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points.
Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C; 60%–69.99%,…
arrow_forward
You are a cyber investigator, your task is to write a python program that can read file signatures from a file and save them into a list. Each file signature is an element of your list. Then, try to find out if there is a JPG file in there. If there is a JPG file, print out a True on screen. (File Signature for JPG file is: FF D8 FF DB)
The input file is: FSCS360_Midterm_Exam_Part2.txt
arrow_forward
The teacher at a school needs help grading an exam with a number of True/False questions. The students’ IDs and test answers are stored in a file. The first entry of the file contains the answer to the test in the form:
TTFTFTTTFTFTFFTTFTTF
Every other entry in the file is the student’s ID, followed by a blank, followed by the students’ response. For instance, the entry:
ABC54102 T FTFTFTTTFTTFTTF TF
The student’s ID is ABC54102, answer to question 1 is True, the answer to question 3 is False. Also, the student did not answer question 2 and question 18. The exam has 20 questions. Here is the grading policy: each correct answer is awarded two points, each wrong answer get -1 point, and no answer gets 0 point. Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score (total points), followed by the test grade. Assume the following grade scale will be used: 90%-100%, A; 80%-89.99%, B; 70%-79.99%, C; 60%-69.99%,…
arrow_forward
.Write code for below problem. The input below is just an example and you should implement
independent from the input. Please paste the link to the answer shared using pastebin,
dotnetfiddle, jsfiddle, or any other similar web-site.
You will have an orthogonal triangle input from a file and you need to find the maximum sum of the numbers
according to given rules below;
1. You will start from the top and move downwards to an adjacent number as in below.
2. You are only allowed to walk downwards and diagonally.
3. You can only walk over NON PRIME NUMBERS.
4. You have to reach at the end of the pyramid as much as possible.
5. You have to treat your input as pyramid.
According to above rules the maximum sum of the numbers from top to bottom in below example is 24.
*1
*8 4
2 *69
85*9 3
As you can see this has several paths that fits the rule of NOT PRIME NUMBERS; 1>8>6>9, 1>4>6>9, 1>4>9>9
1 + 8 + 6 + 9 = 24. As you see 1, 8, 6, 9 are all NOT PRIME NUMBERS and walking over these yields the…
arrow_forward
IN PYTHON: Decrypting with ascii
I have a file called 'dict.txt'. This file contains over 50,000 english words. One word from this file is used as a key (we do not know which one of course). Some have capital letters.
I have another file called 'decrypt.txt' which is a file containing a string of numbers i must decrypt using a key found in the 'dict.txt'. This 'decrypt.txt' file message has length of 300.
My question is, since i do not know which word (from the file with the 50,000+ words) is the key I must use to decrypt the other file, how do I write a function that:
loops through all possible keys from 'dict.txt' to find the one that decrypts my file 'decrypt.txt' best? Somehow i must count how many 'words' are actual words to determine which key is best and then print my final decrypted message.
arrow_forward
fastfoodStats
For this assignment, name your R file fastfoodStats.R
For all questions you should load tidyverse, lm.beta and openintro. You should not need to use any other libraries.
If the openintro package is not installed, you’ll need to do a one-time installation from the Console Window in RStudio like this:install.packages("openintro")
If the lm.beta package is not installed, you’ll need to do a one-time installation from the Console Window in RStudio like this:install.packages("lm.beta")
Load libraries with
suppressPackageStartupMessages(library(tidyverse))suppressPackageStartupMessages(library(lm.beta))
suppressPackageStartupMessages(library(openintro))
Round all float/dbl values to two decimal places.
All statistics should be run with variables in the order I state
E.g., “Run a regression predicting mileage from mpg, make, and type” would be:
lm(mileage ~ mpg + make + type...)
4. Run a regression predicting calories from saturated fat, fiber, and sugar. Based on…
arrow_forward
Using matplotlib, a Python program that reads the contents of the file see attached then plots the data as either a line graph or a bar chart. Be sure to display meaningful labels along the X and Y axes, as well as the tick marks.
The file contains the average gas price for each week in the year 1994. (There are 52 lines in the file.) I copyed and pasted the contents of the file
0.9920.9951.0010.9991.0051.0071.0161.0091.0041.0071.0051.0071.0121.0111.0281.0331.0371.041.0451.0461.051.0561.0651.0731.0791.0951.0971.1031.1091.1141.131.1571.1611.1651.1611.1561.151.141.1291.121.1141.1061.1071.1211.1231.1221.1131.1171.1271.1311.1341.125
arrow_forward
Implement a simple version of the linux grep command in C++. grep - Looks through a file, line by line, trying to find a user-specified search term in the line. If a line has the word within it, the line is printed out, otherwise it is not. Use the system calls open(), getline(), close().
Requirements (examples run from. terminal)
Your program grep is always passed a search term and zero or more files to grep through (thus, more than one is possible). It should go through each line and see if the search term is in it; if so, the line should be printed, and if not, the line should be skipped.
[terminal]$ ./grep ! main.cpp main2.cppcout << "Hello, World!";cout << "Programming is great fun!";
The matching is case sensitive. Thus, if searching for world, lines with World will not match.
Lines can be arbitrarily long (that is, you may see many many characters before you encounter a newline character, \n). grep should work as expected even with very long lines. For this,…
arrow_forward
Write a program that removes all the occurrences of a specifiedstring from a text file. For example, invokingjava Exercise12_11 John filenameremoves the string John from the specified file. Your program should get thearguments from the command line.
arrow_forward
We will use the file classlist.txt. Note that it contains a list of usernames.
3.
Write a script called finduser that is to be called as follows, where classlist is the name of the classlist
file, and username is a particular student's username, either first name or last time.
./finduser classlist username
The script should
check that the correct number of arguments was received and print an error message if not,
check whether the classlist file exists and print an error message if not,
print the line of the given username in the classlist file
If you have not been doing so all along, you should now add some comments to your script and thoroughly
test it!
4.
Write the script into your lab report.
arrow_forward
Write a program that will read the file text.txt which is provided and the encryptedmessage in there. Please write back the decrypted message into the output.txt file.When you see the message in the output.txt file, you need to submit the java codefile. You need to use Rot13 class for decrypting the message. Do not need to submit in the output.txt file.
file example:
public class FileExample {
public static void main(String[]args){
try {//create file object for input.txtFile in_file = new File("src/input.txt");//create file object for output.txtFile out_file = new File("src/output.txt");
//read the input.txt file with ScannerScanner read = new Scanner(in_file);//write the output.txt file with PrintWriterPrintWriter w = new PrintWriter(out_file);
while(read.hasNextLine()){w.write(read.nextLine());}
//don't forget to closew.close();
// while(scan.hasNext()){// System.out.println(scan.next());// }
}catch(Exception ex){ex.getStackTrace();}
arrow_forward
We will need to use a variety of Character class and String class methods to validate the data and separate it in order to process it. We will also use a Characterclass method to allow the user to continue the program if desired. The String class’s split method will allow us to process the tokens in a text file in order to decode a secret message. We will use the first letter of every 5th token read in from a file to reveal the secret message.
Task #2 String.split and the StringBuilder Class
1. Copy the file secret.txt (Code Listing 9.3) from the Student Files or as directed byyour instructor. This file is only one line long. It contains 2 sentences.2. Write a main method that will read the file secret.txt, separate it into wordtokens.3. You should process the tokens by taking the first letter of every fifth word,starting with the first word in the file. Convert these letters to uppercase andappend them to a StringBuilder object to form a word which will be printedto the console to…
arrow_forward
We will need to use a variety of Character class and String class methods to validate the data and separate it in order to process it. We will also use a Characterclass method to allow the user to continue the program if desired. The String class’s split method will allow us to process the tokens in a text file in order to decode a secret message. We will use the first letter of every 5th token read in from a file to reveal the secret message.
Task #2 String.split and the StringBuilder Class
1. Copy the file secret.txt (Code Listing 9.3) from the Student Files or as directed byyour instructor. This file is only one line long. It contains 2 sentences.2. Write a main method that will read the file secret.txt, separate it into wordtokens.3. You should process the tokens by taking the first letter of every fifth word,starting with the first word in the file. Convert these letters to uppercase andappend them to a StringBuilder object to form a word which will be printedto the console to…
arrow_forward
Answer All the questions. Make sure your answers are short and precise.
You can use (Q1.txt or Ed) files to check your answers for Q1.
1. The phone numbers collected from questionnaire is a mess. Design a regular
expression to filter out those numbers that are stored in the standard format
"+00-0-0000-0000" from the file called "Q1.txt" and redirect the results to the
"cleaned.txt".
+61392144979
+61 3 9214 4778
+61-3-9214-4980
+66(2)51574430
+61-3-9285-7706
Note: Only +61-3-9214-4980 and +61-3-9285-7706 are the valid results.
arrow_forward
PLZ help with the following:
Write a batch file where you will cycle trough colors A0, B0, C0, D0, E0, F0. You can use & to execute another command on the same line with a command. Use PAUSE so you may see the results one at a time. After viewing each color, press Spacebar until you cycle through the entire list of colors.
You can use FOR command with the recursive switch (/R ) to execute a command in every directory within a directory folder , effectively “ walking the tree”, starting from the current directory or from another directory you specify and stepping down through each of the subdirectories.
FOR /R %%A IN (list) DO command
arrow_forward
In this laboratory work, you are expected to write a c# console application to make some
operations about the customers. Operations and required featurest that you need to cover in
your program are following:
• Add: This function adds a new person to json file. You need to get inputs from user
and adds the new one into json file.
• Display: This function displays all people in your json file.
• Search: This function let you search with the user id.
• Create Password: This function will create a random password for the user and user
may choose the length of the password. Password may include numbers and
characters.
• Exceptions: You need to handle exceptions as well. You should at least handle 3 of
exceptional cases. For the case that file can not be found, It is mandatory to catch the
exception.
Sample json string:
"FirstName": "Kaan",
"LastName": "OZAYDIN",
"EmployeeId": 101,
"Email": "",
"Password":
"Address": (
"ZipCode": "06460",
"State": "Ankara",
"Country": "Turkey"
"FirstName":…
arrow_forward
in python. Please include docstring, so I can understand each step to this program. Thanks.
you will import the json module.
Write a class named NeighborhoodPets that has methods for adding a pet, deleting a pet, searching for the owner of a pet, saving data to a JSON file, loading data from a JSON file, and getting a set of all pet species. It will only be loading JSON files that it has previously created, so the internal organization of the data is up to you.
The init method takes no parameters and initializes all the data members, which must all be private.
The add_pet method takes as parameters the name of the pet, the species of the pet, and the name of the pet's owner. If a pet has the same name as a pet that has already been added, then the function should raise a DuplicateNameError (you'll need to define this exception class).
The delete_pet method takes as a parameter the name of the pet and deletes that pet.
The get_owner method takes as a parameter the name of the pet and…
arrow_forward
shell script
arrow_forward
IN JAVA ONLY PLEASE. POSITIVE REVIEW WILL BE LEFT FOR CORRECT LANGUAGE ONLY AND NOT COPY PASTE FROM INCORRECT ANSWER
A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names.
Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output.
Ex: If the input of the program is:
ParkPhotos.txt
and the contents of ParkPhotos.txt are:
Acadia2003_photo.jpg AmericanSamoa1989_photo.jpg BlackCanyonoftheGunnison1983_photo.jpg CarlsbadCaverns2010_photo.jpg CraterLake1996_photo.jpg…
arrow_forward
write a program that will open a file called “story.txt”and count the number of occurrences of each letter from the alphabet in this file.At the end your program will output the following report:Number of occurrences for the alphabets:a was used – times.b was used – times.c was used – times…. …and so, onAssume the file contains only lower-case letters and for simplicity just a singleparagraph. Your program should keep a counter associated with each letter of thealphabet (26 counters) [Hint: Use array]Your program should also print a histogram of characters count by addinga new function print Histogram (int counters []). This function receives thecounters from the previous task and instead of printing the number of times eachcharacter was used, prints a histogram of the counters. An example histogram forthree letters is shown below) [Hint: Use the extended asci character 254]:
arrow_forward
You have been hired at an open-air mine. You are to write a program to control a digger. For your task, you have been given a `map' of all the underground resources in the mine. This map comes as a file. The file has n rows. Each row has n space-separated integers. Each integer is between zero and one hundred (inclusive). The file should be understood to represent a grid, n wide by n deep. Each square in the grid can contain valuable resources. The value of these resources can go from zero (no resources) to 100 (max resources). The grid maps the resources just below the surface, and down to the lowest diggable depths. The digger starts at the surface (so, just on top of the topmost row in the grid)—at any horizontal position between 1 and n. The digger cannot dig directly downwards, but it can dig diagonally in either direction, left-down, or right-down. In its first time-step, it will dig onto the first row of the grid. In its second time-step, it'll hit the second row, and so on.…
arrow_forward
You have been hired at an open-air mine. You are to write a program to control a digger. For your task, you have been given a `map' of all the underground resources in the mine. This map comes as a file. The file has n rows. Each row has n space-separated integers. Each integer is between zero and one hundred (inclusive). The file should be understood to represent a grid, n wide by n deep. Each square in the grid can contain valuable resources. The value of these resources can go from zero (no resources) to 100 (max resources).
The grid maps the resources just below the surface, and down to the lowest diggable depths. The digger starts at the surface (so, just on top of the topmost row in the grid)—at any horizontal position between 1 and n. The digger cannot dig directly downwards, but it can dig diagonally in either direction, left-down, or right-down. In its first time-step, it will dig onto the first row of the grid. In its second time-step, it'll hit the second row, and so on.…
arrow_forward
You have been hired at an open-air mine. You are to write a program to control a digger. For your task, you have been given a `map' of all the underground resources in the mine. This map comes as a file. The file has n rows. Each row has n space-separated integers. Each integer is between zero and one hundred (inclusive). The file should be understood to represent a grid, n wide by n deep. Each square in the grid can contain valuable resources. The value of these resources can go from zero (no resources) to 100 (max resources).
The grid maps the resources just below the surface, and down to the lowest diggable depths. The digger starts at the surface (so, just on top of the topmost row in the grid)—at any horizontal position between 1 and n. The digger cannot dig directly downwards, but it can dig diagonally in either direction, left-down, or right-down. In its first time-step, it will dig onto the first row of the grid. In its second time-step, it'll hit the second row, and so on.…
arrow_forward
You have been hired at an open-air mine. You are to write a program to control a digger. For your task, you have been given a `map' of all the underground resources in the mine. This map comes as a file. The file has n rows. Each row has n space-separated integers. Each integer is between zero and one hundred (inclusive). The file should be understood to represent a grid, n wide by n deep. Each square in the grid can contain valuable resources. The value of these resources can go from zero (no resources) to 100 (max resources). The grid maps the resources just below the surface, and down to the lowest diggable depths. The digger starts at the surface (so, just on top of the topmost row in the grid)—at any horizontal position between 1 and n. The digger cannot dig directly downwards, but it can dig diagonally in either direction, left-down, or right-down. In its first time-step, it will dig onto the first row of the grid. In its second time-step, it'll hit the second row, and so on.…
arrow_forward
Write a program that removes all the occurrences of a specified string from a text file. For example, invoking java Exercise12_11Manav filename removes the stringManav from the specified file. Your program should get the arguments from the command line.using java
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Related Questions
- The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points. Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C; 60%–69.99%, D; and…arrow_forwardYou are given a text file (Words.txt) containing 50 words that will be hard to make out because they have been littered with punctuation. Your task is to: • Create a new file called Words2.txt, from Words.txt, which contains all the strings from the previous file, with their position, but with all the punctuation removed. (You must create some sort of method that can loop through the words to do this, you are not allowed to use Regex Patterns) Hint: This might come in handy String punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"; • You must find the first longest word that appears in the text file with their position retained as well as indicating the number of characters therein, the formatting for this can be seen in Table 1.arrow_forwardPython program with unique solution not copied please.arrow_forward
- Instructions The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points. Write a program in C++ that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C;…arrow_forwardInstructions The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points. Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C; 60%–69.99%,…arrow_forwardYou are a cyber investigator, your task is to write a python program that can read file signatures from a file and save them into a list. Each file signature is an element of your list. Then, try to find out if there is a JPG file in there. If there is a JPG file, print out a True on screen. (File Signature for JPG file is: FF D8 FF DB) The input file is: FSCS360_Midterm_Exam_Part2.txtarrow_forward
- The teacher at a school needs help grading an exam with a number of True/False questions. The students’ IDs and test answers are stored in a file. The first entry of the file contains the answer to the test in the form: TTFTFTTTFTFTFFTTFTTF Every other entry in the file is the student’s ID, followed by a blank, followed by the students’ response. For instance, the entry: ABC54102 T FTFTFTTTFTTFTTF TF The student’s ID is ABC54102, answer to question 1 is True, the answer to question 3 is False. Also, the student did not answer question 2 and question 18. The exam has 20 questions. Here is the grading policy: each correct answer is awarded two points, each wrong answer get -1 point, and no answer gets 0 point. Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score (total points), followed by the test grade. Assume the following grade scale will be used: 90%-100%, A; 80%-89.99%, B; 70%-79.99%, C; 60%-69.99%,…arrow_forward.Write code for below problem. The input below is just an example and you should implement independent from the input. Please paste the link to the answer shared using pastebin, dotnetfiddle, jsfiddle, or any other similar web-site. You will have an orthogonal triangle input from a file and you need to find the maximum sum of the numbers according to given rules below; 1. You will start from the top and move downwards to an adjacent number as in below. 2. You are only allowed to walk downwards and diagonally. 3. You can only walk over NON PRIME NUMBERS. 4. You have to reach at the end of the pyramid as much as possible. 5. You have to treat your input as pyramid. According to above rules the maximum sum of the numbers from top to bottom in below example is 24. *1 *8 4 2 *69 85*9 3 As you can see this has several paths that fits the rule of NOT PRIME NUMBERS; 1>8>6>9, 1>4>6>9, 1>4>9>9 1 + 8 + 6 + 9 = 24. As you see 1, 8, 6, 9 are all NOT PRIME NUMBERS and walking over these yields the…arrow_forwardIN PYTHON: Decrypting with ascii I have a file called 'dict.txt'. This file contains over 50,000 english words. One word from this file is used as a key (we do not know which one of course). Some have capital letters. I have another file called 'decrypt.txt' which is a file containing a string of numbers i must decrypt using a key found in the 'dict.txt'. This 'decrypt.txt' file message has length of 300. My question is, since i do not know which word (from the file with the 50,000+ words) is the key I must use to decrypt the other file, how do I write a function that: loops through all possible keys from 'dict.txt' to find the one that decrypts my file 'decrypt.txt' best? Somehow i must count how many 'words' are actual words to determine which key is best and then print my final decrypted message.arrow_forward
- fastfoodStats For this assignment, name your R file fastfoodStats.R For all questions you should load tidyverse, lm.beta and openintro. You should not need to use any other libraries. If the openintro package is not installed, you’ll need to do a one-time installation from the Console Window in RStudio like this:install.packages("openintro") If the lm.beta package is not installed, you’ll need to do a one-time installation from the Console Window in RStudio like this:install.packages("lm.beta") Load libraries with suppressPackageStartupMessages(library(tidyverse))suppressPackageStartupMessages(library(lm.beta)) suppressPackageStartupMessages(library(openintro)) Round all float/dbl values to two decimal places. All statistics should be run with variables in the order I state E.g., “Run a regression predicting mileage from mpg, make, and type” would be: lm(mileage ~ mpg + make + type...) 4. Run a regression predicting calories from saturated fat, fiber, and sugar. Based on…arrow_forwardUsing matplotlib, a Python program that reads the contents of the file see attached then plots the data as either a line graph or a bar chart. Be sure to display meaningful labels along the X and Y axes, as well as the tick marks. The file contains the average gas price for each week in the year 1994. (There are 52 lines in the file.) I copyed and pasted the contents of the file 0.9920.9951.0010.9991.0051.0071.0161.0091.0041.0071.0051.0071.0121.0111.0281.0331.0371.041.0451.0461.051.0561.0651.0731.0791.0951.0971.1031.1091.1141.131.1571.1611.1651.1611.1561.151.141.1291.121.1141.1061.1071.1211.1231.1221.1131.1171.1271.1311.1341.125arrow_forwardImplement a simple version of the linux grep command in C++. grep - Looks through a file, line by line, trying to find a user-specified search term in the line. If a line has the word within it, the line is printed out, otherwise it is not. Use the system calls open(), getline(), close(). Requirements (examples run from. terminal) Your program grep is always passed a search term and zero or more files to grep through (thus, more than one is possible). It should go through each line and see if the search term is in it; if so, the line should be printed, and if not, the line should be skipped. [terminal]$ ./grep ! main.cpp main2.cppcout << "Hello, World!";cout << "Programming is great fun!"; The matching is case sensitive. Thus, if searching for world, lines with World will not match. Lines can be arbitrarily long (that is, you may see many many characters before you encounter a newline character, \n). grep should work as expected even with very long lines. For this,…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning