Questions
C and Systems Programming Part I. Password Strength Meter Weak passwords are common source of e-mail...

C and Systems Programming

Part I. Password Strength Meter

Weak passwords are common source of e-mail and social website accounts hacks. To alleviate this problem, pro-grams, often, when the user chooses a new password, determine if it is an adequately strong password. You are to write a function that validates the password strength. The restrictions that we de ne as our de ned level of strength of passwords is the following: the password must be at least eight characters long, and must include at least one uppercase, one lowercase letter, and one digit. The password cannot contain any other characters than letters and numbers. In addition, it must contain at least one string (consecutive letters) of at least four letters long (uppercase letters, lowecase letters, or combination of both). Furthermore, the password should not contain the username (usernames in our login program are not case-sensitive). Remember, failing to write this piece of code in the program correctly may result in accepting weak and vulnerable passwords. Your code helps rejecting such passwords.

bool i s S t r o n g P a s s w o r d ( const char * username , const char * password ) { // TODO : your code goes here .

}

Enter     username : vahab

Enter     new   password : 1234

Your   password    is week . Try       again !

Enter     username : vahab

Enter     new   password : hello

Your   password    is week . Try       again !

Enter     username : vahab

Enter     new   password : 123 v aH aB k7 89

Your   password    is week . Try       again !

Enter     username : vahab

Enter     new    password : m e A c e C S 2 2 1

Strong    password !

Part II. Default Password Generator

In this part, you will write a C function generateDefaultPassword(char* default_password, const char* username) that generates a default password randomly, which will be sent to the user to login. The users may wish to change the default password to a password of their own, which should pass the password strength meter you implemented in Part I. The default password generated by this function will be stored in a char array that the default_password is pointing to. Remember, the caller of this function (aka main()) must declare an array before passing it to this function, in order to avoid segmentation fault issues.

The default password must be created randomly (every character should be chosen randomly and independently from all allowed characters) and must have all the requirements of a strong password the user selects (Part I) except the following:

The default password must not be longer than 15 characters.

The default password may or may not satisfy the four consecutive letters requirement.

Implement a new function called isStrongDefaultPassword(const char* username, const char* password) which checks if the default password is strong based on the new constraints. This function is almost identical to your isStrongPassword() function in Part I, but needs some modi cations based on the default password requirements. In a loop, your program should then keep creating random strings and check if all the password

requirements for the default password are met. Once a compliant password is generated, the loop stops and your program displays the generated password in the following form:

Generating a default password...

Generated default password:       x1B4fxH81I02

void g e n e r a t e D e f a u l t P a s s w o r d ( char * default_password , const char * username ) {

// TODO : your    code   goes   here .

}

While you are limiting the length of your random password to 15 maximum length, remember that the size of your random password must be random as well.

For both parts, you can write as many helper functions of your own as you like, but as for functions not written by you, you may only use strlen, strcmp, strcpy, and strcat from string.h, and any functions de ned in stdbool.h, stdio.h, ctype.h, time.h, and stdlib.h, only. Your three functions must do exactly as speci ed in this project. You must include all your code relevant to these three functions inside the functions itself. That means, your code must contain these three functions, with the exact function signatures. Your code must compile and run correctly on the Linux lab machines. If we cannot compile your code on the lab machines, you will receive no credit. A small portion of your project grade (5%) is reserved for good code style and adequate comments. While good code style includes many elements, in this class we only grade your projects on suitable variable name choice and indentation.

Here is code for part 1

/**
*
* A password strength meter and a default password generator,
* as defined in the CS221 course website for Project 1.
*
*/

bool isStrongPassword(const char * username, const char * password) {
   //TODO: your code goes here.
   return false;
}

/**
* Example: isStrongDefaultPassword("vahab", "Taher3h") returns false
*/
bool isStrongDefaultPassword(const char* username, const char* password) {
   //TODO: your code goes here.  
   return false;
}

/**
* This function may *not* call isStrongPassword().
* This function must call isStrongDefaultPassword().
*/
void generateDefaultPassword(char * default_password, const char * username) {
   //TODO: your code goes here.  
}

int main(void)
{
   //TODO: your code goes here.
   return 0;
}

In: Computer Science

***This program is to be created using Python*** Requirements to be numbered in program01.py: Print “This...

***This program is to be created using Python***

Requirements to be numbered in program01.py:

  1. Print “This program provides concert seat assignments.”
  2. Ask the user their musical preference and take the following actions based on their potential input:
  • Classical – proceed with the program (i.e. move the next requirement)
  • – output a message that states “We do not recognize the musical genre.” Then end the program.
  1. Ask the user to enter the following data about themselves:

• First Name

• Last Name

• Membership Level

      i. Composer

      ii. Conductor

      iii. Musician

• Seat Preference

      i. Orchestra

      ii. Main

      iii. Balcony

• Meal Type

      i. Chicken

      ii. Fish

      iii. Vegan

  1. Message the following based on criteria (include First and Last Name in messages to user):

• if Composer and Orchestra:

    i. “You qualify for these are exceptional seats!”

• if Composer and Main:

    i. “The seats in the main section are good seats.”

• if Composer and Balcony:

    i. “Interesting, let us know if you want closer seats.”

• if Conductor and Orchestra:

    i. “Member level of Composer required if you want to sit in the orchestra section.”

• if Conductor and Main:

    i. “The seats in the main section are good seats.”

• if Conductor and Balcony:

    i. “Interesting, let us know if you want closer seats.”

• if Musician and Orchestra:

    i. “Member level of Composer required if you want to sit in the orchestra section.”

• if Musician and Main:

    i. “Member level of Composer or Conductor required if you want to sit in the main section.”

• if Musician and Balcony:

  1. “Your balcony seats are confirmed.”
  1. After the concert, the user completes a survey. Ask the user to input a sentiment score 1 – 5 (1 = strongly disagree; 5 = strongly agree) in response to these three statements:

• The concert was wonderful.

• The food was fantastic.

• The seats were superb.

  1. Message to the user based on the following:

• if Composer and (total score less than 12 or any score less than 4):

    i. “Dear Composer, Your survey score of <score> was lower than we would like. Please give us another opportunity soon.”

• Else // Composer

    i. “Thank you for being a Composer member and for having a good time!”

• if Conductor and (total score less than 11 or any score less than 3):

    i. “Dear Conductor, Your survey score of <score> was lower than we would like. The next time you attend we will be nicer.

• Else //Conductor

    i. “Thank you for being a Conductor member and for having a good time!”

• if Musician and (total score less than 10 or any score less than 2):

    i. “Dear Musician, Your survey score of <score> was lower than we would like. You will have more fun next time.”

• Else // Musician

  1. “Thank you for being a Musician member and for having a good time!”

In: Computer Science

- Why do you think that usual maintenance for a widely used website is conducted at...

- Why do you think that usual maintenance for a widely used website is conducted at 12am or 2am.. etc. on weekends? (List three reasons)

- If you believe that a test is successful when it reveals an error then when do you think that it is the time to release a software to market? (Explain in one paragraph)

In: Computer Science

Question 2. The following code defines an array size that sums elements of the defined array...

Question 2. The following code defines an array size that sums elements of the defined array through the loop.

  1. Analyze the following code, and demonstrate the type of error if found?
  2. What we can do to make this code function correctly?

#include <stdio.h>

#define A 10

int main(int argc, char** argv) {

int Total = 0;

int numbers[A];

for (int i=0; i < A; i++)

numbers[i] = i+1;

int i =0;

while (i<=A){

   Total += numbers[i];

   i++;

}

printf("Total =%d\n", Total);

return 0;

}

In: Computer Science

JavaScript Write a function named "reverse_kvs" that has a key-value store as a parameter and returns...

JavaScript
 
Write a function named "reverse_kvs" that has a key-value store as a parameter and returns a new key-value store. Your function should add each key-value pair in the parameter to the new key-value store EXCEPT reversing the key and value. For example, if the key-value "extreme":45 were in the parameter then the returned key-value store should contain the key-value pair 45:"extreme".

Code:
function reverse_kvs(store) {
    var reverse_store = {};
    for (var key in store) {
        if (store.hasOwnProperty(key)) {
            reverse_store[store[key]] = key;
        }
    }
    return reverse_store;
}

I need to have this code return an output other than an empty result. Does anyone know how to fix the code?

*** UPDATE: The code is not correct. It returns an empty result, such as this "{}"***

In: Computer Science

Write in Java Postfix notation is a way of writing expressions without using parentheses. For example,...

Write in Java

Postfix notation is a way of writing expressions without using parentheses. For example, the expression (1 + 2) * 3 would be written as 1 2 + 3 *. A postfix expression is evaluated using a stack. Scan a postfix expression from left to right. A variable or constant is pushed into the stack. When an operator is encountered, apply the operator with the top two operands in the stack and replace the two operands with the result.. Write a program to evaluate postfix expressions. Pass the expression as a command-line argument in one string.

Command line argument:

“1 2 + 3 *”

Correct output (3 points):

9

In: Computer Science

Use winHex to become familiar with different the types. Follow these steps 1) Locate or create...

Use winHex to become familiar with different the types. Follow these steps

1) Locate or create Microsoft Excel(xlsx), Microsoft Word (docx), gif , jpg, and mp3 files if you are creating a word document or an excel spreadsheet save its as a word or excel file.

2) Start WinHex

3) Open each file type in WinHex. Record the hexadecimal codes for each file in a text editor , such has Notepad or Worded. For example for the Word document , record Word Header:50 4B 03 04.

4) Save the file , and then print it to give to your instructor.

Note ) this is forensic class not operation Management class bcoz chegg doesn’t have an option of forensics class so i have to choose operation Management

In: Computer Science

Consider the following page reference string: 1,2,3,5,4,2,1,5,4,2,6,3,1,2,6,3,1,2,4,7,5,4,3,5 How many page faults would occur for replaement by...

Consider the following page reference string:

       1,2,3,5,4,2,1,5,4,2,6,3,1,2,6,3,1,2,4,7,5,4,3,5
       
      How many page faults would occur for replaement by LRU, FIFO, optimal, for
      four frames?  All  frames  are
      initially empty and first unique page reference causes a page fault. Draw the frame for each page reference.

In: Computer Science

In lecture we discussed Milgram’s 1967 experiment; he picked 300 people at random in Nebraska and...

In lecture we discussed Milgram’s 1967 experiment; he picked 300 people at random in Nebraska and asked them to send a letter to a stockbroker in Boston, by way of relaying the letter through a chain of people. The rule is that every person has to know the next person they are sending the 1 letter to on a first name basis. He found that on average each letter went through the hands of 6.4 people before reaching the stockbroker. This is where the expression ”six degrees of separation” comes from. When you tell your friend Dirk about this experiment he says he is not surprised. Dirk says that often, when he tells something to a friend, a couple of days later he hears back the same information from someone else! You decide to test whether the six degrees of separation principle can also be applied to oneself. Let’s imagine that “friendships” on Facebook are a good representation of Milgram’s rule for being on first-name terms with somebody. Assume you are given access to all of the friendship links on Facebook as a graph (where nodes are accounts, and links are “friends”). Design an algorithm to determine if there is a chain of at most 7 friends (because the average number in Milgram’s experiment was 6.4) such that Dirk is friends with both the first and the last person. You may assume that the graph is undirected. For full credit your algorithm should run in time O(m + n) (where n and m are the number of nodes and edges, respectively).

Hint: MODIFY/ USE BFS please helP!

In: Computer Science

In C++ Write a function called findBestSimScore that takes a genome and a sequence and returns...

In C++

Write a function called findBestSimScore that takes a genome and a sequence and returns the highest similarity score found in the genome as a double.

Note: the term genome refers to the string that represents the complete set of genes in an organism, and sequence to refer to some substring or sub-sequence in the genome.

  • Your function MUST be named findBestSimScore

  • Your function should take two parameters in this order:

    • a string parameter for the genome (complete set of genes)

    • a string parameter for the sequence (sub-sequence of the genome)

  • Your function should return the highest similarity score as a double.

  • Your function should not print anything.

The best similarity scores is [0.0,1.0]

Our sequence is "ACT", which is a string of length 3. That means we need to compare our sequence with all the 3 character long sub-sequences (substrings) in the genome.

Examples:

genome sub-sequence

sequence

similarity score

ATACGC

ACT

0.33

ATACGC

ACT

0

ATACGC

ACT

0.66

← findBestMatch returns 0.66, since that is the highest similarity score found

ATACGC

ACT

0

In: Computer Science

In C++ Write a function called findMatchedGenome that takes three genomes and a sequence and prints...

In C++

Write a function called findMatchedGenome that takes three genomes and a sequence and prints the list of matched genomes

  • The function must be named findMatchedGenome
  • The function will take in 4 string input parameters in the order
    • Genome 1, a string
    • Genome 2, a string
    • Genome 3, a string
    • sequence (sub-sequence of the genomes), a string
  • The function should not return anything.
  • Unexpected values might be passed into a function and your function should be able to handle it without crashing the program:
    • If one or more genomes or sequence is an empty string, then it prints “Genomes or sequence is empty.” Function will exit.
    • If the length of the three genomes is different, it prints “Lengths of genomes are different.” Function will exit.

Checking these cases must be performed in the order specified above. First check for empty genomes and sequence followed by a check for different lengths.

Helper functions (the functions used in your findMatchedGenome) should be written in the answer box as well.

For example:

Test Result
//For empty sequence
findMatchedGenome("TTC","GCC","TCT","");
Genomes or sequence is empty.

In: Computer Science

1. For the following C statement, write the corresponding RISC-V assembly code. Assume that the C...

1. For the following C statement, write the corresponding RISC-V assembly code. Assume that the C variables a, b, and c, have already been placed in registers x10, x11, and x12 respectively. Use a minimal number of RISC-V assembly instructions. a = b + (c − 2);

2. Write a single C statement that corresponds to the two RISC-V assembly instructions below. add e, f, g add e, h, e

3. Assume that registers x5 and x6 hold the values 0xA000000000000000 and 0x2000000000000000, respectively.

(1) What is the value of x30 for the following assembly code? add x30, x5, x6

(2) For the contents of registers x5 and x6 as specified above, what is the value of x30 for the following assembly code? sub x30, x5, x6

(3) For the contents of registers x5 and x6 as specified above, what is the value of x30 for the following assembly code? add x30, x5, x6 add x30, x30, x6

In: Computer Science

C PROGRAMMING Identify and correct the errors in each of the following. [Note: There may be...

C PROGRAMMING

Identify and correct the errors in each of the following. [Note: There may be more than one

error in each piece of code.]

a)

if ( sales => 5000 )

puts( "Sales are greater than or equal to $5000" )

else

puts( "Sales are less than $5000 )

b)

int x = 1, product = 0;

while ( x <= 10 ); {

product *= x;

++x;

}

c)

While ( x <= 100 )

total =+ x;
++x;

d)

while ( y < 10 ) {

printf( "%d\n", y );

}

In: Computer Science

you are to write a program in Java, that reads in a set of descriptions of...

you are to write a program in Java, that reads in a set of descriptions of various geometric shapes, calculates the areas and circumferences of the shapes, and then prints out the list of shapes and their areas in sorted order from smallest to largest area. There are four possible shapes: Circle, Square, Rectangle, and Triangle. The last is always an equilateral triangle. The program should read from standard input and write to standard output. The program should read until the end of input is reached, i.e., there is no sentinel value to mark the end of input. There are at most 100 shapes in the input. Each line of the input contains a description of one shape and contains three or four fields separated by a single space. The first field is the name of the particular object (some String). The second field is the type of the shape (one of "Circle", "Square", "Rectangle", or "Triangle" - also a string.) The third field is the size: the radius of the circle, the size of a side of the square, the length of the rectangle, or the size of a side of the triangle. Only the rectangle has a fourth field - the height of the rectangle. The program should read in the input, compute both the area and circumference (or perimeter) of the shape, then sort the shapes by their areas, and print out the shapes in order from smallest to largest area.

Your program must: • Read from standard input and write to standard output. • Work on any size lists up to and including 100, not just the sizes in the example below. • Be efficient. • Have a base class, Shape, for a generic shape. This class must a method, getShape(String desc) which takes the description of a shape (including the name of the object) as described above and returns an appropriate Shape object, a getArea method, a getCircumference method, and a toString method. • Have four subclasses of Shape: Circle, Square, Rectangle, and Triangle.

In: Computer Science

Project title: Automated attendance system using facial recognition system Describe in detail about this title of...

Project title: Automated attendance system using facial recognition system

Describe in detail about this title of project

Research Depth :

- Depth of literature review

- Feasibility of the proposed project

- Implementation plan, methods and strategies

- Incorporating previous comments

In: Computer Science