Skip to content

Commit

Permalink
- added/modify = questions & answers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebazhanov committed Apr 20, 2021
1 parent 7d95578 commit fc1de7c
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 23 deletions.
42 changes: 31 additions & 11 deletions java/java-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class Main {
- [ ] "-123"
- [ ] It will throw an exception on line 5.
- [x] "123"
**Explanation:** The answer is "123". The `abs()` method evaluates to the one inside mypackage.Math class.
#### Q12. What is the result of this code?
Expand Down Expand Up @@ -874,25 +874,26 @@ public class Solution {
- [x] double pi = 3.141;
- [ ] float pi = 3.141;
**Reasoning:**
**Reasoning:**
```java
public class TestReal {
public static void main (String[] argv)
{
double pi = 3.14159265; //accuaracy upto 15 digits
float pi2 = 3.141F; //accuracy upto 6-7 digits

System.out.println ("Pi=" + pi);
System.out.println ("Pi2" + pi2;
}
}
```
```
The default Java type which Java will be using for a float variable will be double.
So, even if you declare any variable as float, what the compiler has to actually do is to assign a double value to a float variable,
which is not possible. So, to tell the compiler to treat this value as a float, that 'F' is used.
```
```
```
The default Java type which Java will be using for a float variable will be double.
So, even if you declare any variable as float, what the compiler has to actually do is to assign a double value to a float variable,
which is not possible. So, to tell the compiler to treat this value as a float, that 'F' is used.
```
#### Q60. Use the magic power to cast a spell
Expand Down Expand Up @@ -970,6 +971,7 @@ try {
- [ ] `DIV`
[Reference](http://www.cs.ukzn.ac.za/~hughm/java/intro/week2/21.html)
#### Q66. Which choice is a disadvantage of inheritance?
- [ ] Overridden methods of the parent class cannot be reused.
Expand Down Expand Up @@ -1014,6 +1016,7 @@ groucyButton.addActionListener(new ActionListener() {
[Reference](https://www.baeldung.com/java-8-functional-interfaces)
#### Q69. What is a valid use of the hashCode() method?
- [ ] encrypting user passwords
- [x] deciding if two instances of a class are equal
- [ ] enabling HashMap to find matches faster
Expand All @@ -1022,6 +1025,7 @@ groucyButton.addActionListener(new ActionListener() {
[Reference](https://www.baeldung.com/java-hashcode)
#### Q70. What kind of relationship does "extends" denote?
- [ ] uses-a
- [x] is-a
- [ ] has-a
Expand All @@ -1030,14 +1034,30 @@ groucyButton.addActionListener(new ActionListener() {
[Reference](https://www.c-sharpcorner.com/UploadFile/3614a6/is-a-and-has-a-relationship-in-java/)
#### Q71. How do you force an object to be garbage collected?
- [ ] Set object to null and call Runtime.gc()
- [x] Set object to null and call System.gc()
- [ ] Set object to null and call Runtime.getRuntime().runFinalization()
- [ ] There is no way to force an object to be garbage collected
[Reference](https://www.baeldung.com/java-hashcode)
[Reference](https://www.baeldung.com/java-hashcode)
#### Q72. Java programmers commonly use design patterns. Some examples are the **\_\_**, which helps create instances of a class, the **\_\_**, which ensures that only one instance of a class can be created; and the **\_\_**, which allows for a group of algorithms to be interchangeable.
#### Q72. Java programmers commonly use design patterns. Some examples are the ______, which helps create instances of a class, the ______, which ensures that only one instance of a class can be created; and the ______, which allows for a group of algorithms to be interchangeable.
- [x] static factory method; singleton; strategy pattern
- [ ] strategy pattern; static factory method; singleton
- [ ] creation pattern; singleton; prototype pattern
- [ ] singleton; strategy pattern; static factory method
#### Q73. Using Java's Reflection API, you can use \_**\_ to get the name of a class and \_\_** to retrieve an array of its methods.
- [x] this.getClass().getSimpleName(); this.getClass().getDeclaredMethods()
- [ ] this.getName(); this.getMethods()
- [ ] Reflection.getName(this); Reflection.getMethods(this)
- [ ] Reflection.getClass(this).getName(); Reflection.getClass(this).getMethods()
#### Q74. What is a valid use of the hashCOde() method?
- [ ] moving objects from a List to a HashMap
- [x] deciding if two instances of a class are equal
- [ ] enabling HashMap to find matches faster
- [ ] encrypting user passwords
46 changes: 34 additions & 12 deletions linux/linux-assesment.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@
```bash
find / -size +10M -exec ls -l {} ;
```

- [ ] It finds all files using ls -l and hands them off to the find command to display.
- [ ] It finds all files older than 10 minutes and long lists them using the ls command.
- [x] It finds all files larger than 10 MB and long lists them using the ls command.
- [ ] It uses the ls command to find all files in the filesystem matching the {} wildcard.

#### Q5. What would this locate command show?

```bash
locate --regexp '^/usr.*pixmaps.*jpg$'
```

- [ ] all files in a directory named pixmaps
- [ ] all files ending in ".jpg"
- [x] all file paths that start with "/usr", include the word "pixmaps", and end with ".jpg"
Expand All @@ -50,7 +53,7 @@ locate --regexp '^/usr.*pixmaps.*jpg$'
#### Q7. Which command will tell you how long a system has been running?

- [ ] log
- [x] uptime
- [x] uptime
- [ ] runtime
- [ ] access

Expand Down Expand Up @@ -84,12 +87,12 @@ ps -e --format uid,pid,ppid,%cpu,cmd
- [ ] !
- [ ] !!
- [ ] !\*
- [x] !ls
- [x] !ls

#### Q12. The ssh-copy-id command copies **\_** to the remote host.

- [ ] both private and public keys
- [x] the ssh public key
- [x] the ssh public key
- [ ] the ssh private key
- [ ] a fingerprint file

Expand Down Expand Up @@ -121,26 +124,26 @@ ps -e --format uid,pid,ppid,%cpu,cmd
- [ ] alternative DNS services
- [x] sources for name service information


#### Q17. Assume the variable myNumber holds a string consisting of 10 digits. What will this command output?

```bash
echo \$myNumber | sed -e 's/^[[:digit:]][[:digit:]][[:digit:]]/(&)/g'
```

- [ ] It will only match digits—and since the string has only digits, the command will output the same number without changes.
- [ ] It will output the same 10-digit number, but every digit will be inside parentheses.
- [ ] It will output the entire 10-digit number inside parentheses.
- [x] It will output the same 10-digit number, but the first 3 digits will be inside parentheses.


#### Q18. Packages can be downloaded but not installed with yum or dnf by specifying which option?

- [ ] None of these answers. yum does not support downloading packages without installing them.
- [ ] --downloaddir
- [ ] -d
- [x] --downloadonly


#### Q19. What character class is equal to this set?

[0-9]

- [ ] [[:alnum:]]
Expand All @@ -149,6 +152,7 @@ echo \$myNumber | sed -e 's/^[[:digit:]][[:digit:]][[:digit:]]/(&)/g'
- [ ] [[:num:]]

#### Q20. When archiving files, which command will preserve all file attributes including ACLs and SELinux security context?

- [ ] zip
- [x] tar
- [ ] archive
Expand All @@ -168,8 +172,8 @@ echo \$myNumber | sed -e 's/^[[:digit:]][[:digit:]][[:digit:]]/(&)/g'
- [ ] vgappend
- [x] vgextend


#### Q23. When would this system cron job run its task?

0 1 \* \* \*

- [ ] every minute of the hour
Expand All @@ -182,7 +186,7 @@ echo \$myNumber | sed -e 's/^[[:digit:]][[:digit:]][[:digit:]]/(&)/g'
- [ ] netconf
- [ ] ipconfig
- [ ] ipman
- [x] ip
- [x] ip

#### Q25. You are managing an Apache web server on a system using SELinux. By default it cannot read personal webpages in users' home directories. What SELinux boolean would you set to allow this?

Expand Down Expand Up @@ -243,84 +247,102 @@ echo \$myNumber | sed -e 's/^[[:digit:]][[:digit:]][[:digit:]]/(&)/g'
#### Q33. Which choice will not print "Hello World" in the terminal?

- [ ]

```bash
myVar = 5
[[ $myVar -lt 10 ]] && echo " Hello World"
```
- [ ]

- [x]

```bash
myVar = 5
[[ $myVar -lt 10 ]] || echo " Hello World"
```
- [X]

- [x]

```bash
myVar = 5
[[ $myVar -gt 10 ]] && echo " Hello World"
```

- [ ]

```bash
myVar = 5
[[ $myVar -gt 10 ]] || echo " Hello World"
```

#### Q34. What is not inherited by child process?

- [x] shell aliases
- [ ] userid
- [ ] environmental variables
- [ ] scheduling priority

#### Q35. What NFS option allows the root user to access NFS shares as the root user?

- [ ] no_admin_squash
- [ ] no_root_squash
- [x] allow_root_access
- [ ] all_squash

#### Q36. You send an email to a remote client using the following syntax. What will be in the body of the email?

```bash
date | mail -s "This is a remote test" user1@rhhost1.localnet.com
```

- [ ] "This is a remote test"
- [ ] the date, the time, and the words "This is a remote test"
- [ ] The email subject shows "This is a remote test" but the body of the email will be empty.
- [ ] The email subject shows "This is a remote test" but the body of the email will be empty.
- [x] the current date and time

#### Q37. What is the /etc/hosts file used for?

- [ ] resolving the local name
- [ ] blocking sites using iptables
- [x] setting the hostname
- [ ] configuring DNS name servers

#### Q38. In an extended regular expression, you would use (pattern){3} to match three instances of the pattern. How would you match the same thing with an extended glob?

- [ ] 3(pattern)
- [ ] {0,3}(pattern}
- [x] Occurrence quantifiers are not supported in Bash's version of extended globs, so this is not possible.
- [ ] {3}(pattern})

#### Q39. When configuring a Samba share, how would the engineering group be specified in the smb.conf?

- [ ] Samba uses Linux operating system groups from the /etc/group file; just specify the group name.
- [x] It would be preceded by a percent sign (%), such as %engineers.
- [ ] Use the group name by itself; Samba checks for its existence.
- [ ] It would be preceded by an @ symbol, such as @engineering.

#### Q40. To configure the Kerberos client, which command should you use to import the keytab file?

- [ ] krb5-workstation
- [x] ktutil
- [ ] pam_krb5
- [ ] kdb5_util

#### Q41. To search from the current cursor position up to the beginning of the file using VIM, type ______ and then the search criteria.
#### Q41. To search from the current cursor position up to the beginning of the file using VIM, type **\_\_** and then the search criteria.

- [x] ?
- [ ] \
- [ ] /
- [ ] /search

#### Q42. What is the job of the NetworkManager daemon?

- [ ] It is a graphical tool that manages network connections, including bonding and wireless networks.
- [ ] It is a security service that manages user access control of local network-aware services.
- [ ] It attempts to keep an active network connection available at all times.
- [x] It is a command-line tool that manages network connections.

#### Q43. Why might would you use the usermod command ?

- [ ] to log out a user
- [ ] to lock a user's account
- [x] to change global user account settings
Expand Down
18 changes: 18 additions & 0 deletions microsoft-word/microsoft-word-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,3 +496,21 @@ D. A flag icon with the colleague's name appears where their edit is being made.
- [ ] an equation
- [ ] a sketch
- [ ] a symbol

#### Q62. You're finalizing a document that contains some high-resolution images. You want to reduce the picture size while ensuring image quality is adequate for online viewing. What is a best-practice approach?

- [ ] Review the images and crop as needed. Compress the images. Save the document and then compress the entire document.
- [ ] Replace the images with lower-resolution images. Save the document and then compress it.
- [x] Review the images and crop as needed. Then compress the images and delete cropped areas.
- [ ] Review the images and crop as needed. Save document and then compress it.

[Reference link](https://support.microsoft.com/en-us/topic/reduce-the-file-size-of-a-picture-in-microsoft-office-8db7211c-d958-457c-babd-194109eb9535)

#### Q63. Before you send a document to an external client, you must remove personal information--including document author names, comments, and hidden text--from the doc. What tool can help you locate and clean up these details??

- [ ] Accessibility Checker
- [ ] Check Compatibility
- [ ] Manage Document
- [x] Document Inspector

[Reference](https://support.microsoft.com/en-us/topic/remove-hidden-data-and-personal-information-by-inspecting-documents-presentations-or-workbooks-356b7b5d-77af-44fe-a07f-9aa4d085966f#:~:text=Click%20File%20%3E%20Info%20%3E%20Remove%20Personal,from%20the%20document%20check%20box.)

0 comments on commit fc1de7c

Please sign in to comment.