Q6 common mistakes in c
5 points
each of the following code samples below is...
Computers and Technology, 05.02.2020 12:56 leylaanddade
Q6 common mistakes in c
5 points
each of the following code samples below is making a common mistake in c. from the options, select the error type that best categorizes the mistake.
you can assume all the code has the necessary #include macros. also you should assume that the system is 32-bit.
1) #define password "correct horse battery staple"
char *check_permissions (char *user_guess) {
if (user_guess = password) {
return "access granted";
}
return "access denied";
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
2) #define password "correct horse battery staple"
char *check_permissions (char *user_guess) {
if (user_guess == password) {
return "access granted";
}
return "access denied";
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
3) int main () {
char *x = malloc(0x * sizeof(char));
x[0] = '! ';
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
4) int foo () {
int *x = malloc(20);
x[0] = x[1] = 1;
x[2] = x[0] + x[1];
x[3] = 99;
return x[3];
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
5) int main () {
char *x = "patrick";
printf("%s", x);
free(x); // tidy up
}
probable segfault
double free
incorrect use of free
logic error
memory leak
no error
Answers: 2
Computers and Technology, 21.06.2019 18:10
For each of the following claims, determine whether they are true or false. justify your determination (show your work). if the claim is false, state the correct asymptotic relationship as o, θ, or ω. unless otherwise specified, lg is log2.(a) (b) (c) (d) (e) (f) (g) (h) (i) (j)n+1 =22n =2n =1 =ln2 n =n2 +2n−4 =33n = 2n+1 =√n = 10100 =o(n4) o(2n)θ(2n+7 ) o(1/n)θ(lg2 n) ω(n2 )θ(9n ) θ(2n lg n )o(lg n) θ(1)
Answers: 1
Computers and Technology, 22.06.2019 01:50
A.) generate scaffolding to create database for your application. develop all the entities identified in assignment #2. add any additional that may be identified later. b.) add data validation rules to the models that are appropriate for your application and data. c.) create links for each scaffold in the header section. part 2: application updates [30 points] a.) add two additional views to the "home" controller you created in assignment #1. b.) the two views should be named as “privacy" and "". c.) link the two newly created views in the footer section. hint: you would need to modify the “home" controller definition and create “privacy.html.erb" and “.html.erb" files in appropriate locations.
Answers: 3
Computers and Technology, 22.06.2019 10:30
You have a large, late-model pick-up truck with a rear seat. the pick-up truck weighs 6,500 pounds. the florida seat belt law
Answers: 1
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
Computers and Technology, 15.04.2020 01:23
Mathematics, 15.04.2020 01:23
Mathematics, 15.04.2020 01:23
Biology, 15.04.2020 01:23