Skip to content

Commit

Permalink
Fix wrong format quiz (Ebazhanov#1384)
Browse files Browse the repository at this point in the history
* fixed maven wrong heading q35

* fixed orther wrong heading

* fixed bash and php

* fixed git quiz, python , wordpress
  • Loading branch information
kevintruong authored Apr 4, 2021
1 parent 0ddba63 commit 6263450
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 51 deletions.
6 changes: 2 additions & 4 deletions bash/bash-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,7 @@ cd -
- [ ] It deletes the current directory
- [ ] It moves you one directory above your current working directory.
# Training questions
#### Q1. What does this command do?
#### Q52. What does this command do?
```bash
cat > notes -
```
Expand All @@ -552,7 +550,7 @@ cat > notes -
- [ ] Outputs the content of notes and deletes it
- [ ] Appends text to the existing "notes"
#### Q2. What is the output of:
#### Q53. What is the output of:
```bash
VAR="This old man came rolling"
echo "\${VAR//man/rolling}"
Expand Down
2 changes: 1 addition & 1 deletion git/git-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ git cherry-pick {kj2342134sdf090093f0sdgasdf99sdfo992mmmf9921231}

#### Q16a. What files is this .gitignore programmed to leave out?
```shell
# .swift
#.swift
build/

*.txt
Expand Down
77 changes: 39 additions & 38 deletions php/php-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
- [ ] You would use this function if you wanted to abort the script for all logged-in users, not just the one who disconnected.
- [ ] You would use this function if you want a PHP script to run forever.

#### Q19. The PHP function array_reduce() takes a callback function that accepts a value carried over each iteration and the current item in the array, and reduces an array to a single value. Which code sample will sum and output the values in the provided array?
##### Q19. The PHP function array_reduce() takes a callback function that accepts a value carried over each iteration and the current item in the array, and reduces an array to a single value. Which code sample will sum and output the values in the provided array?

- [ ]

Expand Down Expand Up @@ -390,14 +390,14 @@ echo sizeof($mathe);
- [ ] no output. Syntax error do to missing semicolon at the end
- [ ] no output due to % in \$num%2!=0

#### Q37. You want to list the modules available in your PHP installation. What command should you run?
##### Q37. You want to list the modules available in your PHP installation. What command should you run?

- [ ] php -h
- [ ] php info
- [ ] php -v
- [x] php -m

#### Q38. For the HTML form below, what is the correct functioning script that checks the input "mail" to be sure it is filled before proceeding?
##### Q38. For the HTML form below, what is the correct functioning script that checks the input "mail" to be sure it is filled before proceeding?

```
if (!empty(\$\_POST["mail"])) {
Expand All @@ -407,7 +407,7 @@ echo "No, mail is not set";
} (correct)
```

#### Q29. What is the value of '$result' in this calculation?
##### Q39. What is the value of '$result' in this calculation?

`$result = 25 % 6;`

Expand All @@ -416,14 +416,14 @@ echo "No, mail is not set";
- [ ] 4
- [x] 1

#### Q30. What is the job of the controller as a component in MVC?
##### Q40. What is the job of the controller as a component in MVC?

- [ ] The controller handles data passed to it by the view, and also passes data to the view. It interprets data sent by the view and disperses that data to the approrpiate models awaiting results to pass back to the view.
- [ ] The controller is a mechanism that allows you to create reusable code in languages such as PHP, where multiple inheritance is not supported.
- [ ] The controller presents content through the user interface, after communicating directly with the database.
- [x] The controller handles specific tasks related to a specific area of functionality, handles business logic related to the results, and communicates directly with the database.

#### Q31. Why does this code trigger an error?
##### Q41. Why does this code trigger an error?

`$string = 'Shylock in a Shakespeare's "Merchangt of Venice" demands his pound of flesh.';`

Expand All @@ -432,51 +432,22 @@ echo "No, mail is not set";
- [ ] The opening and closing single quotes should be replaced by double quotes; and the apostrophe should be escaped by a backslash.
- [x] The apostrophe needs to be escaped by a backslash to prevent it from being treated as the closing quote.

### The following XML document is in books.xml. Which code will output "Historical"?

```
<books>
<book>
<title>A Tale of Two Cities</title>
<author>Charles Dickens</author>
<categories>
<category>Classics</category>
<category>Historical</category>
</categories>
</book>
<title>Then There Were None</title>
<author>Agatha Christies</author>
<categories>
<category>Mystery</category>
</categories>
</book>
</books>
```

- [ ] $books = simplexml_load_string('books.xml');
echo $books->book[0]->categories->category[1];
- [ ] $books = simplexml_load_file('books.xml');
echo $books->book[0]->categories->category[1];
- [x] $books = SimpleXMLElement('books.xml');
echo $books->book[0]->categories->category[1];
- [ ] $books = SimpleXML('books.xml');
echo $books->book[0]->categories->category[1];

#### Q32. A PDO object called $db has been set up to use for database operations, including user authentication. All user-related properties are set. The script line `public function __construct(&$db)` shows a constructor that initializes all user-related properties to \_\_\_\_ if no user has logged in. These parameters will be properly set by the login functions when a user logs in.
##### Q42. A PDO object called $db has been set up to use for database operations, including user authentication. All user-related properties are set. The script line `public function __construct(&$db)` shows a constructor that initializes all user-related properties to \_\_\_\_ if no user has logged in. These parameters will be properly set by the login functions when a user logs in.

- [x] NULL
- [ ] TRUE
- [ ] FALSE
- [ ] 0

#### Q33. Assuming that $first_name and $family_name are valid strings, which statement is invalid?
##### Q43. Assuming that $first_name and $family_name are valid strings, which statement is invalid?

- [ ] echo $first_name. ' '. $familiy_name;
- [x] print $first_name, ' ', $familiy_name;
- [ ] print $first_name. ' '. $familiy_name;
- [ ] echo $first_name, ' ', $familiy_name;

#### Q34. Which code snippet demonstrates encapsulation?
##### Q44. Which code snippet demonstrates encapsulation?

- [ ]

Expand Down Expand Up @@ -517,3 +488,33 @@ class Cow {
}
}
```

##### Q45. The following XML document is in books.xml. Which code will output "Historical"?

```
<books>
<book>
<title>A Tale of Two Cities</title>
<author>Charles Dickens</author>
<categories>
<category>Classics</category>
<category>Historical</category>
</categories>
</book>
<title>Then There Were None</title>
<author>Agatha Christies</author>
<categories>
<category>Mystery</category>
</categories>
</book>
</books>
```

- [ ] $books = simplexml_load_string('books.xml');
echo $books->book[0]->categories->category[1];
- [ ] $books = simplexml_load_file('books.xml');
echo $books->book[0]->categories->category[1];
- [x] $books = SimpleXMLElement('books.xml');
echo $books->book[0]->categories->category[1];
- [ ] $books = SimpleXML('books.xml');
echo $books->book[0]->categories->category[1];
2 changes: 1 addition & 1 deletion python/python-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ fruits = ['Apples', 'Oranges', 'Bananas']
quantities = [5, 3, 4]
prices = [1.50, 2.25, 0.89]
# Desired output
#Desired output
[('Apples', 5, 1.50),
('Oranges', 3, 2.25),
('Bananas', 4, 0.89)]
Expand Down
14 changes: 7 additions & 7 deletions wordpress/wordpress-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,31 +265,31 @@ if ( ! defined( 'ABSPATH' ) ) {
- [ ] MU Admin
- [ ] Multisite Master

### Q38. How would you write a text string containing "Hello World!" in a way that makes it possible for someone else to translate the string into a different language?
#### Q38. How would you write a text string containing "Hello World!" in a way that makes it possible for someone else to translate the string into a different language?
- [ ] apply_filters( 'Hello World!', 'mytextdomain' );
- [x] \_\_( 'Hello World!', 'mytextdomain' );
- [ ] \$string = "Hello World!";
- [ ] esc_html( 'Hello World!', 'mytextdomain' );

### Q39. What is the core mission of WordPress?
#### Q39. What is the core mission of WordPress?
- [x] to make free software
- [ ] to democratize publishing and the freedoms that come with open source
- [ ] to make money
- [ ] to encourage blogging

### Q40. Which of the following is NOT a suggested security improvement for your WordPress website?
#### Q40. Which of the following is NOT a suggested security improvement for your WordPress website?
- [ ] The site should communicate with WordPress.org.
- [ ] Remove inactive themes.
- [ ] Do not output debug information.
- [ ] WordPress updates are accomplished manually only.

### Q41. What's the primary difference between template tags prefaced with the* versus get_the*?
#### Q41. What's the primary difference between template tags prefaced with the* versus get_the*?
- [ ] Template tags prefaced with the\_ can be used directly within a template. Template tags prefaced with get_the are generally reserved for partial templates.
- [ ] Template tags prefaced with the\_ return a value. Template tags prefaced with get_the display a value.
- [ ] Template tags prefaced with the\_ display a value. Template tags prefaced with get_the return a value.
- [ ] Template tags prefaced with the\_ don't accept arguments. Template tags prefaced with get_the do accept arguments.

### Q42. How can you add a custom script that needs to run only on the contact page of a site? The slug of the page is contact.
#### Q42. How can you add a custom script that needs to run only on the contact page of a site? The slug of the page is contact.
```
Link to the script directly from a template named page-contact.php using the get_header() template tag, like this:
get_header( '<script src="/my-script.js"></script>' );
Expand All @@ -315,13 +315,13 @@ add_action( 'wp_enqueue_scripts', 'load_scripts' );
- [ ] <script src="/my-script.js"></script>
- [ ] </head>

### Q43. Where can you find the official WordPress documentation and usage guide?
#### Q43. Where can you find the official WordPress documentation and usage guide?
- [ ] support.wordpress.com
- [ ] developer.wordpress.com
- [x] developer.wordpress.org
- [ ] support.wordpress.org

### Q44. How would you use CSS to ensure your theme was mobile responsive?
#### Q44. How would you use CSS to ensure your theme was mobile responsive?
- [ ] Use CSS grid to create responsive layouts.
- [ ] Use media queries to add breakpoints for different screen sizes.
- [ ] Use Flexbox to create flexible page layouts.
Expand Down

0 comments on commit 6263450

Please sign in to comment.