Главная страница

Open Source Software


Скачать 1.28 Mb.
НазваниеOpen Source Software
Дата26.05.2022
Размер1.28 Mb.
Формат файлаdocx
Имя файлаFinal_OS 2.docx
ТипДокументы
#551026
страница39 из 39
1   ...   31   32   33   34   35   36   37   38   39

4. How would you get the value of a variable named VAR into a script?

Ans: read VAR

5. Select the correct statement:

Ans: A bash function must be placed before it is used in a script


1. Which command will list all files under the current directory with a .cfg extension, and then delete them?

Ans: find . -name "*.cfg" -exec rm {} ';'

2. Which command will list all files and directories on the system with cfg in their name?

Ans: ls -l $(locate cfg)

3. Which command will find all files and directories in the system whose name ends with cfg?

Ans: locate -r "cfg$"

4. Which commands can change all occurrences within a file of the string boris to natasha (Select all answers that apply)?

Ans:

  • sed -e s:boris:natasha:g file

  • sed -e s/boris/natasha/g file

5. Which command will print out all lines beginning with "X" in all files in the current directory?

Ans: grep "^X" *


1. Which command is used to combine three files into a fourth file?

Ans: cat file1 file2 file3 > file4

2. Which of the following commands can be used to view the last 15 lines of a file (Select all answers that apply)?

Ans:

  • tail -15 some_file

  • tail -n15 some_file

3. Which of the following commands will replace all instances of the word "dog" with "pig" in the file named some_file and send the output to stdout (Select all answers that apply)?

Ans:

  • sed -e s:dog:pig:g some_file

  • sed -e s/dog/pig/g some_file

  • cat some_file | sed -e s/dog/pig/g

4. Which commands can be used to print the lines that contain the numbers 0–5 in a file (Select all answers that apply)?

Ans:

  • grep [0,1,2,3,4,5] filename

  • grep [0-5] filename

5. Which command is used to extract columns from a file to work on them later?

Ans: cut


1. Which statement is correct?

Ans: In Linux, file types are rarely determined by extension letters

2. If the first character in the long file listing is a "-", the listed object is a:

Ans: Normal File

3. If the first character in the long file listing is an "s", the listed object is a:

Ans: Unix Domain Socket

4. Which of the following commands are equivalent (Select all answers that apply):

Ans:

  • chown donald.ducks file

  • chown donald file ; chgrp ducks file

  • chown donald:ducks file

5. Which command will give all users the right to look at a file, but give only the owner the right to change it or execute it:

Ans: chmod 744 some_file


1. Which of the following are journaling filesystems (Select all answers that apply):

Ans:

  • btrfs

  • ext4

  • XFS

2. For a filesystem to be mounted at boot:

Ans: It must be listed in /etc/fstab

3. When mounting a filesystem, it may be specified by any of the following methods (Select all answers that apply):

Ans:

  • Device node

  • UUID

  • Label

4. LVM stands for:

Ans: Logical Volume Management

5. Loopback filesystems (Select all answers that apply):

Ans:

  • Have slower performance than just having a native filesystem

  • Can be useful for testing filesystem features


1. Use of a package management system (Select all true statements):

Ans: Simplifies upgrade and update of individual software packages, as well as the system

2. Which of the following distributions use the RPM package management system (Select all answers that apply)?

Ans:

  • SUSE

  • Red Hat

  • Fedora

  • CentOS

3. Which of the following distributions use the APT (dpkg) package management system (Select all answers that apply)?

Ans:

  • Linux Mint

  • Ubuntu

  • Debian

4. With RPM, all information to configure, compile and install is contained in:

Ans: The spec file

5. Which of the following statements are true (Select all answers that apply)?

Ans:

  • The source package contains one file in RPM-based systems

  • The source package contains multiple files in Debian-based systems


1. GCC stands for:

Ans: GNU Compiler Collection

2. A good choice of compiler options for day-to-day use would be:

Ans: gcc -O2 -Wall -pedantic program.c

3. Why might you choose to link your program statically, rather than use a shared library version?

Ans: The static program will not use new versions of shared libraries as they become available, and thus may avoid breakage and bugs

4. To find the shared libraries used by /usr/bin/cp you can do (Select all answers that apply):

Ans:

  • ldd $(which cp)

  • ldd /usr/bin/cp

5. Which statements are true (Select all answers that apply):

Ans:

  • Use of shared libraries can cause bugs because the application may conflict with the new library version

  • Applications can load faster when using shared libraries

  • Use of shared libraries saves memory

  • Use of shared libraries enables applications to stay up to date with new library features without being recompiled


1. Which of the following statements are true (Select all answers that apply)?

Ans:

  • Java programs developed on other systems can be expected to run without modification on Linux

  • There are a number of choices which can be used for the Java implementation on Linux machines, and one can switch between them

  • The biggest problem in porting Java code to Linux is often fear

2. Which utility can be used to select the default Java Implementation on a Linux system?

Ans: alternatives

3. Which commands will show you information about which version of Java you are running (Select all answers that apply):

Ans:

  • readlink−f(which java)

  • java -version

4. Which of the following are Integrated Development Environments that can be used for Java on Linux (Select all answers that apply)?

Ans:

  • NetBeans

  • Eclipse

5. If you are experienced in using Eclipse on another operating system, when moving to Linux:

Ans: The interface and functioning should be almost the same and have little or no learning curve required


1. Which statement is true?

Ans: Virtually all Linux distributions have a new enough version of git in their normal binary packaging systems you can use for all day-to-day work. You only need the latest version if you are developing git itself

2. Which statement is true?

Ans: It is irrelevant how a repository is created or updated, you can use either a command line or graphical interface to git

3. What command you must issue to list all files in the repository?

Ans: git ls-files

4. What does the git rm some_file command do?

Ans: Removes some_file from the repository and from the working file tree

5. Which of the following statement about an "ignored" file in git is correct?

Ans: An ignored file is enumerated in a .gitignore file


1. Which revision control system requires a user to lock a file when it is checked out, so that other developers cannot work on it easily at the same time?

Ans: RCS

2. Which revision control systems have a central repository which may be on a network server (Select all answers that apply):

Ans:

  • CVS

  • Subversion

3. When using git:

Ans: Conflicts between different developers require manual examination and fixing by a maintainer

4. Select the true statement:

Ans: It is possible to convert Git repositories for use by Subversion and CVS

5. Select the true statement:

Ans: It is possible to import (convert) CVS and Subversion repositories into Git


1. Revision control systems are

Ans: Useful even with a sole developer working on a project

2. Git was originally a creation of:

Ans: Linus Torvalds

3. Which statement is true?

Ans: With Git, conflicting contributions must be resolved by a human being

4. Which of the following commands will provide documentation on how to create a new branch with git (Select all answers that apply)?

Ans:

  • git branch --help

  • man git-branch

  • git help branch

5. Which of the following are Revision Control Systems? Select all answers that apply.

Ans:

  • Git

  • Subversion

  • CVS


1. How can you get a brief list of all git subcommands?

Ans: git

2. Which command initializes a new Git repository:

Ans: git init

3. How would you store in the repository the user's name and email address?

Ans: git config user.name "myname"; git config user.email "me@linux"

4. Which command places new files in the repository?

Ans: git add

5. Which command puts changes in the repository?

Ans: git commit


1. In Git, branching is the inverse process to:

Ans: merging

2. A detailed branching history can be shown by:

Ans: git show-branch

3. To examine an earlier version of a file in commit 3888bc981a, do:

Ans: git show 3888bc981a:kernel/sys.c

4. You can list all current branches on the local machine with:

Ans:

  • git branch

  • git branch --list

  • git branch -v

5. The command git checkout some_branch

Ans: switches to some_branch


1. What does the command git revert c87e6ae4 do?

Ans: Removes the changes associated with the commit that starts with c87e6ae4

2. To see which files have changed and what the exact changes are, do:

Ans: git log -p

3. Some time over the past 1000 commits, a change was introduced that caused a program to fail. Assuming you have a good test to establish a bad version, what is the largest number of bisects that should be needed to locate the commit containing the defective patch?

Ans: 10

4. In the command git gc, what does gc stand for?

Ans: garbage collection

5. The command git blame some_file:

Ans: Tells you where every line in some_file came from by date and author


1. If there are two branches, br1 and br2, showing all differences between them can be done with:

Ans: git diff br1 br2

2. Showing which files have changed between two branches can be done with (Select all answers that apply):

Ans:

  • git diff --stat br1 br2

  • git diff --numstat br1 br2

3. Showing all differences between the current working tree and the last commit can be done with:

Ans: git diff

4. In the command git diff tag1 name2, if tag1 is a tag, name2 can be a (select all correct answers):

Ans:

  • another tag

  • a branch name

  • a previous commit identifier

5. How can you see the differences in file1 between tag1 and tag2?

Ans: git diff tag1 tag2 file1


1. In git, the fundamental content-full object that is stored, is called a:

Ans: blob

2. When a repository is "forked", the new repository

Ans: Is structurally equal to the old one and contains the entire history

3. Publishing a repository means:

Ans: Making the results visible and available to other contributors

4. Upstream and downstream git repositories are:

Ans: Structurally the same; it is a socio-political decision which repositories are upstream or downstream

5. The long hexadecimal numbers associated with git commits:

Ans: Serve as both identifiers and helpful checksums


1. An "ignored" file in git is one that:

Ans: Is enumerated in a .gitignore file

2. The command git rm some_file:

Ans: Removes some_file from the working file tree and the index

3. The command rm some_file

Ans: Removes some_file from working file tree, but not from the repository

4. To list all files in the repository, issue the command:

Ans: git ls-files

5. The command git mv some_file new_name_or_location

Ans: Moves (renames) the file in both the repository and the working tree


1. Which procedure does a better job of preserving a project's history?

Ans: git merge

2. Why might a merge result in problems that do not show conflicts (select all correct answers)?

Ans:

  • There may be two different solutions to the same problem which interfere with other

  • A merge might affect code in a very different part of the product in a non-obvious way and not receive enough testing

3. A git rebase

Ans: adapts a branch to incorporate the latest changes in another branch without yet merging this branch into the other branch

4. How would you merge two branches (br1 and br2) into the master branch?

Ans: git checkout master && git merge br1 && git merge br2

5. What do you do when a merge fails?

Ans: Evaluate the conflict, see what the correct result should be and then fix


1. Gerrit is:

Ans: An enhanced method of using git for more complex projects

2. What are some of the advantages of using Gerrit? Select all answers that apply.

Ans:

  • It introduces a more robust layer of code review by potentially mutliple individuals

  • It can reduce single maintainer bottlenecks

3. Gerrit works best when:

Ans: There is one change per commit

4. With Gerrit, contributors submit their work to:

Ans: The reviewing layer, rather than fully upstream

5. With Gerrit, reviewers:

Ans: Work with both the upstream and contributor layers


1. When you clone a remote repository, you receive:

Ans: A complete copy, including all branches and their detailed history

2. To make a compressed tarball of the most current version of your repository, do:

Ans: git archive HEAD > myproject.tar.gz | git archive | gzip > myproject.tar.gz

3. Someone's remote branch could be merged into a certain branch on a repository by using (select all that apply):

Ans:

  • Having the person issue a pull request and then having the maintainer take care of it

  • Having the person doing a push if and only if that person has commit privileges for the remote repository

4. A bare repository:

Ans: Has no working files and is used only for cloning, fetching and pushing

5. To make a repository on your machine visible to others across the internet using the git protocol you must:

Ans: Configure and enable the git daemon service


1. To get all patches between your current branch and the master branch, do:

Ans: git format-patch master

2. The best way to form patches for use with git is to:

Ans: Use git-format-patch

3. In modern advanced distributed projects, submitting patches through email is:

Ans: Something only used for relatively simple submissions, often to subsystem maintainers

4. When applying patches:

Ans: It is a good idea to test first with the --dry-run option

5. Select the true statement:

Ans: Most modern email clients do not have built-in support for git, so one needs to worry about whitespace, line-wrapping and other potential problems
1   ...   31   32   33   34   35   36   37   38   39


написать администратору сайта