GIT (Global information Tracker) Assessment Test Answers

Linkedin GIT (Global information Tracker) Assessment Test Answers


Git is a distributed version control system, which means that every developer has a copy of the entire codebase and its history on their local machine. Developers can work independently on their own branches, making changes and committing them to their local copy of the codebase. When they are ready, they can push their changes to a central repository, where other developers can pull and merge them with the main codebase.
Git allows for a wide range of collaboration and coordination among developers, through features such as:
Pulling and pushing changes: Developers can easily retrieve and share changes with the rest of the team.
Branching and merging: Developers can create separate branches for different features or bug fixes, and then merge those changes with the main codebase when they are ready.
Conflict resolution: Git makes it easy to resolve conflicts that can occur when multiple people are working on the same code.
Code reviews: Git allows for easy collaboration through code reviews, where developers can review and comment on each other's code.

In summary, Git is a powerful tool for software development that allows for collaboration, coordination, and efficient management of changes in code among developers.


Linkedin GIT (Global information Tracker) Assessment Test Answers


1. Why would you use a pre-receive hook in your remote repository?

  • You wouldn't, you would use it in the local repository
  • 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

2. What option can you use to apply git configurations across your entire git environment?

  • --all
  • --master
  • --global
  • --update

3. How could you squash multiple commits together without using git merge --squash?

  • Caching
  • You can't. git merge --squash is the only git command for that operation.
  • Rebasing
  • Reflogging

4. If you cloned an existing git repository, what would happen?

  • A new copy would overwrite the central repository
  • A copy of the repository would be created on your local machine
  • Nothing, cloning is not a supported git function
  • A copy of the repository would be created on the hosting platform

5. How can you display a list of files added or modified in a specific commit?

  • Find the commit in the remote repository, as that's the only place that kind of information is stored.
  • Use the diff -tree command with the commit hash.
  • Run git commit --info with the commit hash.
  • Access the commit stash data with git stash.

6. What files is this .gitignore programmed to leave out?

    #.swift
    build/ .
    *.txt
    *.metadata
  • All files with a .swift, .txt, or metadata file extension, as well as the entire build directory
  • Only the build directory
  • All files in the build directory, as well as files ending with .txt or .metadata
  • Only files with .swift and .txt extensions.

7. After you make changes to a local repository, you run the following command. What will this do?

    git commit -a -m "Refactor code base"
  • Nothing, you can't use multiple options in the same command
  • Adds all new files to the staging area
  • Commits all new files with a message
  • Adds all modified files to the staging area, then commits them with a message

8. After checking your git status you get the following output, which shows the file beta-notes.js in the commit but also unstaged. How can this situation occur?


    Change to be committed: 
    (use "git reset HEAD <file>..." to unstage) 
    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) 
    modified: beta-notes.js

  • There were two copies of beta-notes.js but one was deleted
  • beta-notes.js was staged, then modified afterwards, creating two different versions of the file
  • Two copies of beta-notes.js were created, but only one is being tracked
  • There are two tracked copies of beta-notes.js, but one was removed from the commit

9. Where are files stored before they are committed to the local repository?

  • Saved files
  • git documents
  • Staging area
  • git cache 

10 . What commands would you use to force an overwrite of your local files with the master branch?

    git pull --all 
    git reset --hard origin/master

    git pull -u origin master 
    git reset --hard master

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

    git fetch --all 
    git reset --hard origin/master
  

11. What is the best way to characterize the git commit structure?

  • Data array
  • Data log
  • Data snapshot
  • Data dictionary

12. What change will the following command make to the staging area files?


     git rm --cached testfile.js

  • testfile.js will be removed from the staging area and its changes no longer tracked.
  • testfile.js will be removed from the staging area but its changes will still be tracked.
  • A copy of testfile.js will be cached on your desktop.
  • The current copy of testfile.js will be saved in the staging area.

13. After you've successfully merged two branches and committed the changes, what is the next step in keeping your git structure organized?

  • Use the git reset --soft HEAD to roll back one commit.
  • Run git branch -d <branch name> to delete the merged branch.
  • Use git clear-all to clean up any hanging files.
  • Run git rebase to move the current commit to its original location.

14. 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?

This is not possible, as you cannot save locally without committing.

15. What command would you use to create a new git repository?

git add

16. While working on a feature branch you try to use "git rerere" to solve a recurring merge conflict but nothing is happening. What could be causing this issue?

The "-all" option isn't added to the command.

17. Which setting determines what pager is used when Git pages output?

core.page

18. What does commit object contain?

A set of files, representing the state of a project at a given point of time.

19. Which option enables inclusion of committer name in custom log format?

%ce

20. How many ways are present in Git to integrate changes from one branch into another?

  • 3
  • 5
  • 2
  • 4

21. Which user should be created first during setting up of SSH?

admin

22. Which command will list tags with the 1.4.2 series?

git tag 'v1.4.2'

23. Which of the following is an integration manager?

lieutenants

24. Which Git command begins tracking of a new file?

addfile

25. Which of the following is called dumb protocol?

All of these

26. Which key press returns a set of suggestions to pick from, when writing a Git command?

Control

27. Which of these terms best describes Git?

Issue Tracking System

28. Which command gets a copy of an existing Git repository?

duplicate

29. How does Git think of its data?

  • File
  • None of these
  • Snapshot
  • Folder

30. Which option enables inclusion of author name in custom log format?

%am

31. Which version onwards did Git offer reversing a file back to what it looked like when last committed?

1.7

32. Which strategy is used by Git for merging two branches?

LIFO

33. What does refs store?

None of these

34. What Language is used in GIT?

C++

35. What is usually the extension of file which has the public key?

ssh

36. What is the difference between initializing a normal repo and a bare repo?

Bare repos store their git history in a .git subfolder.

37. How many individual commits can a single repository have?

only one commit local per repository

38. What types of tags does Git support?

heavy and concise

39. After staging a series of changes to the index, which command could you use to review them prior to a commit?

git diff

40. What does the git stash drop command do?

deletes the stash

41. How can you check your current git version?

  • git --v
  • git --version
  • git --option
  • git --current

42. What command lets you create a connection between a local and remote repository?

  • git remote add new
  • git remote add origin
  • git remote new origin
  • git remote origin

43. Describe what the following git commands do to the commit history. 

    git reset --hard HEAD~5 git merge --squash HEAD@{1}

  • Reset the HEAD to the 5th commit in the repo, then merges to the master branch
  • Reset the commit branch back before the last 5 commits, then squashes them into a single commit
  • Delete the last 5 commits
  • Merges the last 5 commits into a new branch

44. Your current project has several branches; master, beta, and push-notifications. You've just finished the notification feature in the push-notification branch, and you want to commit it to beta branch. How can you accomplish this?

  • Checkout the push-notifications branch and run git merge beta
  • Checkout the master branch and run git merge beta -> push-notification
  • Delete the push-notification branch and it will be committed to the master branch automatically
  • Checkout the beta branch and run git merge push-notification

45. Which of the following is true you when you use the following command?

    git add -A
  • All new and updated files are staged
  • Files are staged in alphabetical order.
  • All new files are staged
  • Only updated files are staged

46. What will the following command print to the Terminal?

    git remote -v
  • A list of remote repositories and their URLs
  • The current git version you're running
  • An inline editor for modifying remote repositories
  • The last 5 git versions you've installed

47. Looking at the following commands, describe what is happening. 


git checkout feature-user-location 
git cherry-pick kj2342134sdf090093f0sdgasdf99sdfo992mmmf9921231

  • The commit is being tagged for release on the feature-user-location branch
  • A commit is being copied from its original branch over to the feature-user-location branch
  • The commit is being cherry picked as the new HEAD of the commit history
  • A commit is being copied from the feature-user-location branch to the master branch

48. What does the following command do to the git repository?

    git reset --soft HEAD^
  • It deletes all previous commits and reset the repository history back to its initial state.
  • It resets the working branch to the first commit.
  • It keeps the HEAD at the current commit, but clears all previous commits.
  • It sets HEAD to the previous commit and leaves changes from the undone commit in the stage/index.

49. You find a bug in your project, but can't locate where it was introduced in the commit history. How would you diagnose this problem?

  • Manually backtrack through your commit history.
  • Use git search -diff to compare all commits in your repository history.
  • Run a git rebase to find the buggy commit.
  • Use git bisect to compare the buggy commit to an early commit that works as expected.

50. Why would the following command be used?

git rebase -i HEAD~10

  • To run a comparative search of the last 10 commits for differences
  • To list the last 10 commits and modify them with either the squash or fixup command
  • To delete the last 10 commits and reset the HEAD
  • In order to locally cache the last 10 commits

51. Which statement is true when you use the git add -A command?

Only new files in the working directory are staged to the index.

52. You find that your project has a tag and branch both named push-notifications, which causes confusion when trying to print out given reference. How can you specify which branch you want to look at?

  • use git show refs/push-notifications
  • use git show push-notifications
  • use git show head/refs/push-notifications
  • use git show refs/head/push-notifications

53. Your team lead needs a list of all commits that will be moved before you perform a rebase. Which command can you use to access that information?

  • git rebase -log
  • git rebase -i
  • git rebase -verbose
  • git rebase -all

54. What is the operation doing given the Git commands below? 

    git bisect start 
    git bisect bad 5d41402abc4b2a76b9719d911017c592 
    git bisect good 69faab6268350295550de7d587bc323d
  • It runs a merge of a good commit that is discovered using a known bad commit and known good commit
  • It marks a commit for deletion using a known bad commit and known good commit to determine which commit introduced a bug
  • It defines a bad commit and resets the HEAD using a known bad commit and known good commit
  • It performs a binary search using a known bad commit and known good commit to determine which commit introduced a bug

55. In a situation where you have several commits for a single task, what is the most efficient way to restructure your commit history?

  • Cherry pick the related commits to another branch.
  • Delete the task commits and recommit with a new message.
  • Squash the related commits together into a single coherent commit.
  • Stash the related commits under a new hash.

56. Which of the following is true of the git push command?

  • By default a push doesn't send tags to the remote repository.
  • Commits can only be tagged when they are created.
  • Tags are pushed to the remote repository with their respective commits.
  • Only annotated tags are automatically pushed to the remote repository with a commit.

57. After pushing commits to the remote repository for the first time using the command below, what shorthand command can you use in future? 

    git push -u origin master
  • git push master
  • git push origin
  • Same as before, git push -u origin master
  • git push

58. How would you create a custom shortcut or command across your git environment?

Run git hotfix with the shortcut name.
Assign a shortcut or command using git options file.
Use the git custom-key command.
Create an alias in the git config file.

59. What is the status of the beta-notes.js file in the following output? 

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) 
modified: beta-notes.js
  • beta-notes.js is untracked and has been modified.
  • 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.

60. What command would let you modify your previous commit?

  • --fix
  • --quickfix
  • --modify
  • --amend

Linkedin GIT (Global information Tracker) Assessment Test Answers

People also searched for 


Post a Comment (0)
Previous Post Next Post