Skip to content

Commit

Permalink
update git/Python/Java assesment (Ebazhanov#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkAlexWang authored Aug 3, 2020
1 parent 964a461 commit 25649cc
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 61 deletions.
21 changes: 11 additions & 10 deletions git/git-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

#### Q3. Describe what the following git commands do to the commit history.

`git reset --hard HEAD~5`
`git reset --hard HEAD~5`
(Reset the current branch to the commit just before the last 5)

`git merge --squash HEAD@{1}`
`git merge --squash HEAD@{1}`
(HEAD@{1} is where the branch was just before the previous command. This command sets the state of the index to be as it would just after a merge from that commit)

- [ ] Reset the HEAD to the 5th commit in the repo, then merges to the master branch
Expand Down Expand Up @@ -89,7 +89,8 @@

#### Q11. Why would you use a pre-receive hook in your remote repository?
- [ ] You wouldn't, you would use it in the local repository
- [x] To invoke a hook script when commits are pushed but before any references are updated
- [x] To execute a script when a remote receives a push that is triggered
before any refs are updated
- [ ] To fire a script after updates are made to the remote repository
- [ ] To debug all commit tags and release versions

Expand Down Expand Up @@ -138,7 +139,7 @@
Change to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: beta-notes.js
modified: beta-notes.js
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout --<file>..." to discard changes in working directory)
Expand Down Expand Up @@ -197,7 +198,7 @@ git cherry-pick {123safd23e}
- [x] git rebase -i
- [ ] git rebase -verbose
- [ ] git rebase -all

#### Q26. What is the operation doing given the Git commands below?

```
Expand Down Expand Up @@ -252,7 +253,7 @@ Changes not staged for commit:
modified: beta-notes.js
```

- [ ] beta-notes.js is untracked and has been modified.
- [ ] beta-notes.js is untracked and has been modified.
- [x] beta-notes.js is a tracked file and has been modified, but has not been added to the current commit.
- [ ] beta-notes.js is untracked but has been added to the current commit.
- [ ] beta-notes.js is tracked, and the modified file has been added to the current commit.
Expand Down Expand Up @@ -307,7 +308,7 @@ git rm --cached testfile.js

- [ ] The "-all" option isn't added to the command.
- [x] "rerere.enabled" isn't enable in the config file.
- [ ] The commit hash is missing.
- [ ] The commit hash is missing.
- [ ] The filepath isn't specified.

#### Q39. What commands would you use to force an overwrite of your local files with the master branch?
Expand All @@ -326,14 +327,14 @@ git pull -u origin master
git reset --hard master
```

- [ ] Option 3
- [] Option 3

```git
git pull origin master
git reset --hard origin/myCurrentBranch
```

- [ ] Option 4
- [x] Option 4

```git
git fetch --all
Expand All @@ -342,6 +343,6 @@ git reset --hard origin/master
#### Q40. While modifying a file, you're unexpectedly assigned an urgent bug fix on another branch. How can you temporarily save your local work without committing?

- [ ] Save your work with git local-cache.
- [x] Use git stash to save your work, then come back later and reapply the stashed commit.
- [x] Use git stash to save your work, then come back later and reapply the stashed commit.
- [ ] Run git hold to save a local copy of waht you're doing to return to later.
- [ ] This is not possible, as you cannot save locally without committing.
38 changes: 19 additions & 19 deletions java/java-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Java Assessment
- traw

#### Q2. How can you achieve runtime polymorphism in Java?
- method overloading
- method overrunning
- method overloading
- method overrunning
- method overriding <<<<--- Correct
- method calling
- method calling

#### Q3. Given the following definitions, which of these expression will NOT evaluate to true?
`boolean b1 = true, b2 = false;
Expand Down Expand Up @@ -79,7 +79,7 @@ System.out.println(str);
4: }
5: static Exception print(int i){
6: if (i>0) {
7: return new Exception();
7: return new Exception();
8: } else {
9: throw new RuntimeException();
10: }
Expand All @@ -89,7 +89,7 @@ System.out.println(str);
- It will show a stack trace with a runtime exception.
- "java.lang.Exception" <<<<---Correct
- It will run and throw an exception.
- It will not compile. <--- Correct
- It will not compile.

#### Q9. Which class can compile given these declarations?
```
Expand All @@ -102,30 +102,30 @@ System.out.println(str);
7: System.out.println(""One"");
8: } }
```
-
-
```
class Three implements One, Two {
publc void method() {
super.One.method();
} }
```
-
-
```
class Three implements One, Two {
publc void method() {
One.method();
} }
```
-
-
```
class Three implements One, Two {
}
```
-
-
```
class Three implements One, Two { <------ correct
publc void method() {
One.super.method();
One.super.method();
} }
```

Expand Down Expand Up @@ -271,7 +271,7 @@ for(){iterator.hasNext()}{}
#### Q21. You have an ArrayList of names that you want to sort alphabetically. Which approach would NOT work?
- names.sort(Comparator.comparing(String::toString))
- Collections.sort(names)
- names.sort(List.DESCENDING)
- names.sort(List.DESCENDING) <<<--- Correct (not too sure)
- names.stream().sorted((s1, s2) -> s1.compareTo(s2)).collect(Collectors.toList())

#### Q22. By implementing encapsulation, you cannot directly access the class's _____ properties unless you are writing code inside the class itself.
Expand All @@ -284,19 +284,19 @@ for(){iterator.hasNext()}{}
- new SimpleDateFormat("yyyy-MM-dd").format(new Date())
- new Date(System.currentTimeMillis())
- LocalDate.now()
- Calender.getInstance().getTime()
- Calender.getInstance().getTime() <<<<--- Correct

#### Q24. Fill in the blank to create a piece of code that will tell wether int0 is divisible by 5:
'''
```
boolean isDivisibleBy5 = _____
'''
```
- int0 / 5 ? true: false
- int0 % 5 == 0 <<<<---Correct
- int0 % 5 != 5
- Math.isDivisible(int0, 5)

#### Q25. How many time will this code print "Hello World!"?
'''
```
Class Main {
public static void main(String[] args){
for (int i=0; i<10; i=i++){
Expand All @@ -305,7 +305,7 @@ Class Main {
}
}
}
'''
```
- 10 times
- 9 times
- 5 times <<<<---Correct
Expand All @@ -318,7 +318,7 @@ Class Main {
- main <<<<---Correct

#### Q27. What is the result of this code?
'''
```
try{
System.out.print("Hello World");
}catch(Exception e){
Expand All @@ -328,7 +328,7 @@ try{
}finally{
System.out.println("!")
}
'''
```
- It will throw a runtime exception
- It will not compile
- Hello World! <<<<---Correct
Expand All @@ -338,4 +338,4 @@ try{
- An anonymous class may specify an abstract base class as its base type.
- An anonymous class does not require a zero-argument constructor. <<<<---Correct
- An anonymous class may specify an interface as its base type.
- An anonymous class may specify both an abstract class and interface as base types
- An anonymous class may specify both an abstract class and interface as base types
Loading

0 comments on commit 25649cc

Please sign in to comment.