Quiz About Programing Languagem

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Jimmy_James
J
Jimmy_James
Community Contributor
Quizzes Created: 1 | Total Attempts: 454
Questions: 119 | Attempts: 454

SettingsSettingsSettings
Programming Language Quizzes & Trivia

Questions and Answers
  • 1. 

    What is true regarding the statement beginning with #! that is found in the first line of a script?

    • A.

      It prevents the script from being executed until the ! is removed.

    • B.

      It specifies the path and the arguments of the interpreter used to run the script.

    • C.

      It is a comment that is ignored by the script.

    • D.

      It specifies the character encoding of the script.

    Correct Answer
    B. It specifies the path and the arguments of the interpreter used to run the script.
    Explanation
    The correct answer is that the statement beginning with #! in the first line of a script specifies the path and the arguments of the interpreter used to run the script. This is known as the "shebang" or "hashbang" line, and it is used to indicate which interpreter should be used to execute the script. The shebang line is typically followed by the path to the interpreter executable and any necessary command-line arguments.

    Rate this question:

  • 2. 

    Which Bash option prevents a user from accidentally overwriting a file with a “>”?

    • A.

      Set -o safe

    • B.

      Set -o noglob

    • C.

      Set -o noclobber

    • D.

      Set -o append

    • E.

      Set -o nooverwrite

    Correct Answer
    C. Set -o noclobber
    Explanation
    The correct answer is "set -o noclobber". This option prevents a user from accidentally overwriting a file with a ">" symbol by refusing to overwrite an existing file when using the ">" redirection operator.

    Rate this question:

  • 3. 

    Which of the following commands prints the exit value of the most recently executed program inBash?

    • A.

      Echo $?

    • B.

      Echo $#

    • C.

      Echo $exit

    • D.

      Echo $status

    • E.

      Echo $&

    Correct Answer
    A. Echo $?
    Explanation
    The command "echo $?" prints the exit value of the most recently executed program in Bash. The "$?" is a special variable in Bash that holds the exit status of the last executed command. By using the "echo" command, we can display the value of this variable, which represents the exit code of the previous program.

    Rate this question:

  • 4. 

    What word will complete an if statement in bash such as the following: if [ -x “$file” ]; then echo $file _____(Please provide the missing word only)

    Correct Answer
    fi
    Explanation
    The missing word in the if statement is "fi". In bash, the "fi" keyword is used to close an if statement. It signifies the end of the block of code that should be executed if the condition in the if statement is true.

    Rate this question:

  • 5. 

    What word is missing from the following SQL statement? update tablename ____ fieldname=’value’ where id=909;(Please specify the missing word using lower\_case letters only.)

    Correct Answer
    set
    Explanation
    The missing word in the SQL statement is "set". In an SQL update statement, the "set" keyword is used to specify the column or columns to be updated and their corresponding values. In this case, the missing word "set" is required to indicate that the fieldname should be updated with the given value where the id is equal to 909.

    Rate this question:

  • 6. 

    Which of the following SQL statements will select the fields name and address from the contactstable?

    • A.

      SELECT (name, address) FROM contacts;

    • B.

      SELECT (name address) FROM contacts;

    • C.

      SELECT name, address FROM contacts;

    • D.

      SELECT name address FROM contacts;

    Correct Answer
    C. SELECT name, address FROM contacts;
    Explanation
    The correct answer is "SELECT name, address FROM contacts;". This statement selects the fields "name" and "address" from the "contacts" table. The SELECT keyword is used to specify the columns to be retrieved, and the FROM keyword is used to specify the table from which the data should be retrieved.

    Rate this question:

  • 7. 

    Which of the following configuration files should be modified to globally set shell variables for all users?

    • A.

      /etc/bashrc

    • B.

      /etc/profile

    • C.

      ~/.bash_profile

    • D.

      /etc/.bashrc

    Correct Answer
    B. /etc/profile
    Explanation
    The correct answer is /etc/profile. This file is a system-wide configuration file that sets environment variables and runs commands for all users on the system. Modifying this file allows for the global setting of shell variables that will be applied to all users when they log in. The other options (/etc/bashrc, ~/.bash_profile, and /etc/.bashrc) are either user-specific or not applicable for setting variables globally for all users.

    Rate this question:

  • 8. 

    Which of the following commands are used to manage the environment and shell variables within a shell process?(Choose TWO correct answers.)

    • A.

      Export

    • B.

      Init

    • C.

      Reset

    • D.

      Set

    • E.

      Tset

    Correct Answer(s)
    A. Export
    D. Set
    Explanation
    The "export" command is used to set environment variables and make them available to child processes. The "set" command is used to display or set shell variables and their values. Both commands are used to manage the environment and shell variables within a shell process.

    Rate this question:

  • 9. 

    Which of the following are operators used for comparisons by the test command? (Choose TWO correct answers.)

    • A.

      Equals

    • B.

      =

    • C.

      -is

    • D.

      -eq

    • E.

      Null

    Correct Answer(s)
    B. =
    D. -eq
    Explanation
    The operators "=" and "-eq" are used for comparisons by the test command. The "=" operator checks if two values are equal, while the "-eq" operator checks if two numeric values are equal. These operators are commonly used in conditional statements to compare values and make decisions based on the result of the comparison.

    Rate this question:

  • 10. 

    Which of the following commands creates a function in Bash that outputs the sum of twonumbers?

    • A.

      Function sumitup { echo $(($1 + $2)) ; }

    • B.

      Command sumitup { echo $(($1 + $2)) ; }

    • C.

      Function sumitup { echo $1 + $2 ; }

    • D.

      Method sumitup { echo $1 + $2 ; }

    • E.

      Command sumitup { echo $1 + $2 ; }

    Correct Answer
    A. Function sumitup { echo $(($1 + $2)) ; }
    Explanation
    The correct answer is "function sumitup { echo $(($1 + $2)) ; }". This is the correct command syntax to create a function in Bash that outputs the sum of two numbers. The function is named "sumitup" and it uses the echo command to display the sum of the two input numbers, which are represented by the variables $1 and $2. The sum is calculated using the arithmetic expression $(($1 + $2)).

    Rate this question:

  • 11. 

    What output will the following command sequence produce?echo ‘1 2 3 4 5 6’ | while read a b c; do echo result: $c $b $a; done

    • A.

      Result: 3 4 5 6 2 1

    • B.

      Result: 1 2 3 4 5

    • C.

      Result: 6 5 4

    • D.

      Result: 6 5 4 3 2 1

    • E.

      Result: 3 2 1

    Correct Answer
    A. Result: 3 4 5 6 2 1
    Explanation
    The given command sequence uses the "echo" command to print the string "1 2 3 4 5 6" and then pipes it to the "while" loop. The "while" loop reads the input and assigns the values to variables "a", "b", and "c". Then, it echoes the result in the format "result: $c $b $a". The loop continues until there are no more values to read.

    In this case, the loop will execute twice. The first time, it assigns "1" to variable "a", "2" to variable "b", and "3" to variable "c". The result is echoed as "result: 3 2 1". The second time, it assigns "4" to variable "a", "5" to variable "b", and "6" to variable "c". The result is echoed as "result: 6 5 4". Therefore, the correct answer is "result: 3 4 5 6 2 1".

    Rate this question:

  • 12. 

    When the command echo $? outputs 1, which of the following statements are true?

    • A.

      It is the process ID of the echo command.

    • B.

      It is the process ID of the current shell.

    • C.

      It is the exit value of the command executed immediately before echo.

    • D.

      It is the exit value of the echo command.

    Correct Answer
    C. It is the exit value of the command executed immediately before echo.
    Explanation
    When the command echo $? outputs 1, it means that the previous command executed before the echo command returned an exit value of 1. The exit value is a numerical value that indicates the success or failure of a command in Unix-like operating systems. In this case, the exit value of the previous command was 1, which typically indicates an error or failure. Therefore, the statement "It is the exit value of the command executed immediately before echo" is true.

    Rate this question:

  • 13. 

    What word is missing from the following SQL statement? insert into tablename ________(909,‘text’);(Please specify the missing word using lower-case letters only.)

    Correct Answer
    values
    Explanation
    The missing word in the SQL statement is "values". The statement is an INSERT INTO statement, which is used to insert data into a table. The missing word is the keyword that indicates that the following values are being inserted into the table.

    Rate this question:

  • 14. 

    Which command makes the shell variable named VARIABLE visible to subshells?

    • A.

      Export $VARIABLE

    • B.

      Export VARIABLE

    • C.

      Set $VARIABLE

    • D.

      Set VARIABLE

    • E.

      Env VARIABLE

    Correct Answer
    B. Export VARIABLE
    Explanation
    The correct answer is "export VARIABLE". The export command is used to make a shell variable visible to subshells. By using the export command followed by the variable name, the variable is made available to any child processes or subshells that are created from the current shell. This allows the variable to be accessed and used in those subshells.

    Rate this question:

  • 15. 

    What output will the command seq 10 produce?

    • A.

      A continuous stream of numbers increasing in increments of 10 until stopped.

    • B.

      The numbers 1 through 10 with one number per line.

    • C.

      The numbers 0 through 9 with one number per line.

    • D.

      The number 10 to standard output.

    Correct Answer
    B. The numbers 1 through 10 with one number per line.
    Explanation
    The command "seq 10" will produce the numbers 1 through 10 with one number per line. The "seq" command is used to generate a sequence of numbers, and in this case, it will generate a sequence starting from 1 and ending at 10, with each number printed on a separate line.

    Rate this question:

  • 16. 

    By default, the contents of which directory will be copied to a new user’s home directory when the account is created by passing the -m option to the useradd command? (Specify the full path to the directory.)

    Correct Answer
    /etc/skel
    Explanation
    When a new user account is created using the useradd command with the -m option, the contents of the /etc/skel directory will be copied to the new user's home directory. The /etc/skel directory contains default files and directories that are meant to be copied to each new user's home directory, providing them with a basic set of configuration files and templates.

    Rate this question:

  • 17. 

    What word is missing from the following SQL statement?__________ count(*) from tablename;(Please specify the missing word using lower-case letters only.)

    Correct Answer
    select
    Explanation
    The missing word in the SQL statement is "select". In SQL, the "select" keyword is used to retrieve data from a database table. It is followed by the columns or expressions that need to be selected. In this case, the statement is incomplete as it is missing the columns or expressions to be selected.

    Rate this question:

  • 18. 

    Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)

    • A.

      ~/.bashconf

    • B.

      ~/.bashrc

    • C.

      ~/.bashdefaults

    • D.

      ~/.bash_etc

    • E.

      ~/.bash_profile

    Correct Answer(s)
    B. ~/.bashrc
    E. ~/.bash_profile
    Explanation
    The ~/.bashrc file affects the behavior of the Bash shell. It is a script that is executed whenever a new interactive shell is started. It can be used to set environment variables, define aliases, and configure other shell settings.

    The ~/.bash_profile file also affects the behavior of the Bash shell. It is executed when a user logs in to the system. It is typically used to set up the user's environment and execute any necessary initialization commands.

    Both of these files allow users to customize their Bash shell environment and behavior.

    Rate this question:

  • 19. 

    After issuing: function myfunction { echo $1 $2 ; } in Bash, which output does: myfunction A B C Produce?

    • A.

      A B

    • B.

      A B C

    • C.

      A C

    • D.

      B C

    • E.

      C B A

    Correct Answer
    A. A B
    Explanation
    The given function myfunction takes two arguments and echoes them. After issuing the function myfunction A B C, it will only consider the first two arguments A and B, and the output will be A B.

    Rate this question:

  • 20. 

    Which of the following commands puts the output of the command date into the shell variablemydate?

    • A.

      Mydate=”$(date)”

    • B.

      Mydate=”exec date”

    • C.

      Mydate=”$((date))”

    • D.

      Mydate=”date”

    • E.

      Mydate=”${date}”

    Correct Answer
    A. Mydate=”$(date)”
    Explanation
    The correct answer is mydate=”$(date)”. This command uses command substitution to capture the output of the "date" command and assign it to the shell variable "mydate". The $(date) syntax executes the "date" command and returns its output, which is then assigned to the variable "mydate".

    Rate this question:

  • 21. 

    What is the purpose of the sticky keys feature in X?

    • A.

      To assist users who have difficulty holding down multiple keys at once.

    • B.

      To prevent repeated input of a single character if the key is held down.

    • C.

      To ignore brief keystrokes according to a specified time limit.

    • D.

      To repeat the input of a single character.

    Correct Answer
    A. To assist users who have difficulty holding down multiple keys at once.
    Explanation
    The purpose of the sticky keys feature in X is to assist users who have difficulty holding down multiple keys at once. This feature allows users to press and release modifier keys, such as Shift, Ctrl, or Alt, and have them remain active until the next key is pressed. This helps individuals with physical disabilities or limited dexterity to perform keyboard shortcuts and combinations more easily.

    Rate this question:

  • 22. 

    On a machine running several X servers, how are the different instances of the X11 serveridentified?

    • A.

      By a fixed UUID that is defined in the X11 configuration file.

    • B.

      By a unique IPv6 address from the fe80::/64 subnet.

    • C.

      By the name of the user that runs the X server like x11:bob.

    • D.

      By a device name like /dev/X11/xservers/1.

    • E.

      By a display name like:1.

    Correct Answer
    E. By a display name like:1.
    Explanation
    The different instances of the X11 server are identified by a display name, which is typically in the format ":". This display name is used to differentiate between the various X servers running on the machine. The number after the colon represents the display number, indicating which instance of the X server it is. For example, ":1" would refer to the second X server running on the machine.

    Rate this question:

  • 23. 

    What is the purpose of the xhost program?

    • A.

      Grant or revoke access to a X11 session.

    • B.

      Install all packages and video drivers required to run X11 on a host.

    • C.

      Start the X11 server and announce its availability within the local network.

    • D.

      Send informational messages to all users logged into a host using X11.

    • E.

      Display the MOTD and other important information when a user logs in via X11

    Correct Answer
    A. Grant or revoke access to a X11 session.
    Explanation
    The purpose of the xhost program is to grant or revoke access to a X11 session. It allows the user to control which hosts are allowed to connect to their X server and display graphical applications. This is important for security reasons, as it allows the user to restrict access to their X session and prevent unauthorized users from accessing their display.

    Rate this question:

  • 24. 

    What of the following statements is true regarding a display manager?

    • A.

      A display manager handles remote X11 logins only and has no purpose on a system that is not attached to a network.

    • B.

      The display manager is configured in the X11 configuration file xorg.conf.

    • C.

      There is only one display manager X11DM that must be started on all systems running X11.

    • D.

      After system startup, the display manager handles the login of a user.

    • E.

      Without a display manager, no graphical programs can be run.

    Correct Answer
    D. After system startup, the display manager handles the login of a user.
    Explanation
    The display manager is responsible for managing the login process of a user after the system startup. It provides a graphical interface for users to log in and start their session. Without a display manager, users would not be able to access the graphical environment and run graphical programs.

    Rate this question:

  • 25. 

    How is a display manager started?

    • A.

      It is started by a user using the command startx.

    • B.

      It is started like any other system service by the init system.

    • C.

      It is started by inetd when a remote hosts connects to the X11 port

    • D.

      It is started automatically when a X11 user logs in to the system console

    Correct Answer
    B. It is started like any other system service by the init system.
    Explanation
    The display manager is started like any other system service by the init system. This means that it is initialized and launched during the boot process of the operating system. The init system is responsible for managing the startup and shutdown processes of various system services, including the display manager. By starting the display manager as a system service, it ensures that it is available and running for users to log in and access the graphical user interface.

    Rate this question:

  • 26. 

    What is the default name of the configuration file for the Xorg X11 server? (Specify the file name only without any path.)

    Correct Answer
    xorg.conf
    Explanation
    The default name of the configuration file for the Xorg X11 server is "xorg.conf". This file is responsible for configuring various settings and options for the Xorg server, such as display resolutions, input devices, and graphics drivers. By default, the Xorg server looks for this file in the /etc/X11/ directory.

    Rate this question:

  • 27. 

    Which of the following commands shows the current color depth of the X Server?

    • A.

      Xcd

    • B.

      Xcdepth

    • C.

      Xwininfo

    • D.

      Xcolordepth

    • E.

      Cat /etc/X11

    Correct Answer
    C. Xwininfo
    Explanation
    The xwininfo command is used to obtain information about windows in the X Server. It can display various details about the windows, including the current color depth. Therefore, xwininfo is the command that shows the current color depth of the X Server.

    Rate this question:

  • 28. 

    For accessibility assistance, which of the following programs is an on-screen keyboard?

    • A.

      Xkb

    • B.

      Atkb

    • C.

      GOK

    • D.

      XOSK

    Correct Answer
    C. GOK
    Explanation
    GOK is an on-screen keyboard program. It stands for GNOME On-Screen Keyboard and it is designed to provide an alternative input method for users who have difficulty using a physical keyboard. GOK allows users to type using a virtual keyboard that appears on the screen, which can be operated using a mouse, touchpad, or other pointing devices. This program is particularly useful for individuals with motor disabilities or impairments that prevent them from using a traditional keyboard.

    Rate this question:

  • 29. 

    What is the name of the simple graphical login manager that comes with a vanilla X11 installation?(Specify ONLY the command without any path or parameters.)

    Correct Answer
    xdm
    Explanation
    The correct answer is xdm. Xdm is a simple graphical login manager that is included in a vanilla X11 installation. It allows users to log in to their X Window System desktop environments by providing a graphical interface for entering their credentials. Xdm is a lightweight and straightforward login manager that is commonly used in Unix-like operating systems.

    Rate this question:

  • 30. 

    Which of the following are tasks handled by a display manager like XDM or KDM? (Choose TWO correct answers.)

    • A.

      Start and prepare the desktop environment for the user.

    • B.

      Configure additional devices like new monitors or projectors when they are attached.

    • C.

      Handle the login of a user.

    • D.

      Lock the screen when the user was inactive for a configurable amount of time.

    • E.

      Create an X11 configuration file for the current graphic devices and monitors

    Correct Answer(s)
    A. Start and prepare the desktop environment for the user.
    C. Handle the login of a user.
    Explanation
    A display manager like XDM or KDM handles the tasks of starting and preparing the desktop environment for the user, as well as handling the login of a user. These tasks involve managing the graphical interface, authenticating the user, and setting up the necessary environment for the user to interact with the system. The display manager is responsible for presenting the login screen, allowing the user to enter their credentials, and then launching the appropriate desktop environment once the user is authenticated.

    Rate this question:

  • 31. 

    Which of the following commands can modify or set the password expiration for a user? (Choose TWO correct answers.)

    • A.

      Chage

    • B.

      Chexpiration

    • C.

      Shadowconfig

    • D.

      Passwd

    • E.

      Userconf

    Correct Answer(s)
    A. Chage
    D. Passwd
    Explanation
    The chage command is used to modify or set the password expiration for a user. It allows system administrators to change the number of days between password changes and the maximum number of days the password is valid. The passwd command is also used to modify or set the password for a user, which indirectly affects the password expiration. Therefore, both chage and passwd are correct answers for this question.

    Rate this question:

  • 32. 

    Which of the following statements is true regarding the /etc/shadow file?

    • A.

      /etc/shadow may not be readable or writable by user root.

    • B.

      Only root is allowed to read and write /etc/shadow.

    • C.

      All users have full read and write access to /etc/shadow.

    • D.

      All users have full read access to /etc/shadow.

    Correct Answer
    B. Only root is allowed to read and write /etc/shadow.
    Explanation
    The /etc/shadow file is a crucial file in Linux systems that stores encrypted user passwords. It contains sensitive information, so it is important to restrict access to it. The correct answer states that only the root user is allowed to read and write the /etc/shadow file. This means that regular users do not have access to this file, ensuring the security of user passwords.

    Rate this question:

  • 33. 

    Which of the following commands will convert files from one character encoding to another?

    • A.

      Convert

    • B.

      Enc2utf

    • C.

      Iconv

    • D.

      Transcode

    Correct Answer
    C. Iconv
    Explanation
    The command "iconv" is used to convert files from one character encoding to another. It is a commonly used command-line tool that can convert text between different character encodings. With "iconv", users can specify the input and output character encodings, allowing them to convert files to the desired encoding. This command is widely available on various operating systems and is a reliable option for converting file encodings.

    Rate this question:

  • 34. 

    Which environment variable will override all LC_* variables?

    • A.

      LANG

    • B.

      LC_ALL

    • C.

      LC_COLLATE

    • D.

      LOCALE

    Correct Answer
    B. LC_ALL
    Explanation
    LC_ALL is an environment variable that can be used to override all other LC_* variables. It sets the locale for all aspects of the user interface, including collation, numeric, monetary, and date/time formatting. When LC_ALL is set, it takes precedence over other LC_* variables such as LC_COLLATE and LC_COLLATE. Therefore, if LC_ALL is set, it will override any specific settings made by other LC_* variables.

    Rate this question:

  • 35. 

    Which command will set the local machine’s timezone to UTC?

    • A.

      Cat UTC > /etc/timezone

    • B.

      Ln -s /usr/share/zoneinfo/UTC /etc/localtime

    • C.

      Date –timezone=UTC

    • D.

      Mv /usr/timezone/UTC /etc

    Correct Answer
    B. Ln -s /usr/share/zoneinfo/UTC /etc/localtime
    Explanation
    The correct answer is "ln -s /usr/share/zoneinfo/UTC /etc/localtime". This command creates a symbolic link between the UTC timezone file in the /usr/share/zoneinfo directory and the /etc/localtime file, effectively setting the local machine's timezone to UTC.

    Rate this question:

  • 36. 

    Which of the following actions prevents a specific user from scheduling tasks using at or batch?

    • A.

      Add the specific user to the /etc/at.allow file.

    • B.

      Add the specific user to the [deny] section in the /etc/atd.conf file.

    • C.

      Add the specific user to the /etc/at.deny file.

    • D.

      Add the specific user to the nojobs group.

    • E.

      Run atd –deny followed by the name of the specific user.

    Correct Answer
    C. Add the specific user to the /etc/at.deny file.
    Explanation
    Adding the specific user to the /etc/at.deny file prevents them from scheduling tasks using at or batch. The /etc/at.deny file contains a list of users who are not allowed to use the at or batch commands. By adding the specific user to this file, their access to these commands is denied.

    Rate this question:

  • 37. 

    What is the main difference between the batch and at commands?

    • A.

      The batch command will run multiple times. The at command will only run once.

    • B.

      The commands of a batch job run sequentially one after another while the commands in at jobs may run in parallel.

    • C.

      The at command reads commands from standard input. The batch command requires a command line argument

    • D.

      The at command e-mails results to the user. The batch command logs results to syslog.

    Correct Answer
    B. The commands of a batch job run sequentially one after another while the commands in at jobs may run in parallel.
    Explanation
    The main difference between the batch and at commands is that the commands of a batch job run sequentially one after another, while the commands in at jobs may run in parallel. This means that in a batch job, each command will wait for the previous one to finish before executing, whereas in an at job, multiple commands can be executed simultaneously.

    Rate this question:

  • 38. 

    Why should a regular user edit his personal crontab by using the command crontab instead of just editing his crontab file manually?

    • A.

      Because user specific crontab entries are stored in a common database and must be extracted before editing.

    • B.

      Because crontab starts the cron daemon in case it is not running due to no other crontab entries existing

    • C.

      Because user specific crontab entries are stored in a special directory which is maintained by the cron daemon and not writable for regular users.

    • D.

      Because crontab collects information about all users crontabs and recommends similar commands used by other users of the system.

    Correct Answer
    C. Because user specific crontab entries are stored in a special directory which is maintained by the cron daemon and not writable for regular users.
    Explanation
    The correct answer states that a regular user should use the "crontab" command to edit their personal crontab because user specific crontab entries are stored in a special directory that is maintained by the cron daemon and not writable for regular users. This means that manually editing the crontab file may not have any effect on the user's scheduled tasks, as the changes need to be made through the proper command to ensure they are stored in the correct directory and recognized by the cron daemon.

    Rate this question:

  • 39. 

    What is true about groups in a Linux system?(Choose TWO correct answers.)

    • A.

      Each user may be a member of several groups. However, only one group is the user’s primary group.

    • B.

      Groups may have a password that allows users to join that group temporarily.

    • C.

      Each user can only be a member of one group at a time.

    • D.

      Group memberships are optional such that there may be users that do not belong to any group.

    • E.

      Groups can be nested meaning that one group can be a member of another group.

    Correct Answer(s)
    A. Each user may be a member of several groups. However, only one group is the user’s primary group.
    B. Groups may have a password that allows users to join that group temporarily.
    Explanation
    In a Linux system, each user can be a member of multiple groups, but only one group is designated as the user's primary group. This primary group is used for file ownership and permissions. Additionally, groups in Linux can have a password that allows users to temporarily join that group, granting them access to specific resources or privileges. This password-based group membership is a flexible feature that provides temporary access control.

    Rate this question:

  • 40. 

    What is true about UIDs and GIDs?

    • A.

      UIDs and GIDs share a common number space. Each time a new user or group is created, the next free ID is assigned.

    • B.

      The first four digits of each UID are the GID of the primary group of that user.

    • C.

      The GID of a group is always the sum of the UIDs of its members.

    • D.

      The number space is split up. UIDs usually reside in the range from 0 to 32767 while GIDs reside in the range from 32768 to 65535

    • E.

      There are distinct number spaces for UIDs and GIDs, i.e. the same number may be used as both a UID and a GID.

    Correct Answer
    E. There are distinct number spaces for UIDs and GIDs, i.e. the same number may be used as both a UID and a GID.
    Explanation
    The explanation for the given answer is that UIDs and GIDs have separate number spaces, meaning that the same number can be used as both a UID and a GID. This means that a user and a group can have the same identification number without conflict.

    Rate this question:

  • 41. 

    What happens if the password of a user in the /etc/shadow file is prepended with the ! character?

    • A.

      When logging in, the user automatically gets root privileges in addition to his regular privileges.

    • B.

      The password is inverted which allows the user to log in with any password other than the current password.

    • C.

      The user is disabled and all login methods, including but not limited to password based logins, are disabled.

    • D.

      Upon the next log in, the user is forced to change his password.

    • E.

      The password becomes invalid which disables password based logins although other login methods remain usable.

    Correct Answer
    E. The password becomes invalid which disables password based logins although other login methods remain usable.
  • 42. 

    Which of the following details can be found in an entry of a user specific crontab? (Choose TWO correct answers.)

    • A.

      The verbal description of the job.

    • B.

      The syslog facility to where the output of the job should be sent.

    • C.

      The time when the cron job should run.

    • D.

      The command that should be started by the cron job.

    • E.

      The name of the user which should run the job.

    Correct Answer(s)
    C. The time when the cron job should run.
    D. The command that should be started by the cron job.
    Explanation
    An entry in a user specific crontab contains the time when the cron job should run and the command that should be started by the cron job. The crontab allows users to schedule and automate tasks at specific times or intervals. The time field specifies when the job should be executed, and the command field specifies the command or script that should be run. The other options, such as the verbal description of the job, the syslog facility, and the user's name, are not typically included in a crontab entry.

    Rate this question:

  • 43. 

    Each entry in a crontab must end with what character?

    • A.

      Tab

    • B.

      Space

    • C.

      Backslash

    • D.

      Newline

    Correct Answer
    D. Newline
    Explanation
    Each entry in a crontab must end with a newline character. This is because crontab files are read line by line, and the newline character indicates the end of a line. Without a newline character at the end of each entry, the crontab file would not be properly formatted and the cron daemon would not be able to interpret the entries correctly.

    Rate this question:

  • 44. 

    To prevent a specific user from scheduling tasks with at, what should the administrator do?

    • A.

      Add the specific user to /etc/at.allow file.

    • B.

      Add the specific user to [deny] section in the /etc/atd.conf file.

    • C.

      Add the specific user to /etc/at.deny file.

    • D.

      Add the specific user to nojobs group.

    • E.

      Run the following: atd –deny [user].

    Correct Answer
    C. Add the specific user to /etc/at.deny file.
    Explanation
    The correct answer is to add the specific user to the /etc/at.deny file. This file contains a list of users who are not allowed to use the at command to schedule tasks. By adding the specific user to this file, the administrator effectively prevents them from scheduling tasks with the at command.

    Rate this question:

  • 45. 

    Which of the following crontab entries will execute myscript at 30 minutes past every hour onSundays?

    • A.

      0 * * * 30 myscript

    • B.

      30 * * * 6 myscript

    • C.

      30 0 * * 0 myscript

    • D.

      30 0-23 * * 0 myscript

    • E.

      0 0-23 * * 30 myscript

    Correct Answer
    D. 30 0-23 * * 0 myscript
    Explanation
    This crontab entry will execute myscript at 30 minutes past every hour on Sundays. The first field represents the minutes, the second field represents the hours, the third field represents the days of the month, the fourth field represents the months, and the fifth field represents the days of the week. In this case, "30" in the first field indicates that the script should be executed at 30 minutes past the hour, "0-23" in the second field indicates that it should be executed every hour from 0 to 23, and "0" in the fifth field indicates that it should be executed only on Sundays.

    Rate this question:

  • 46. 

    Which of the following files assigns a user to its primary group?

    • A.

      /etc/pgroup

    • B.

      /etc/shadow

    • C.

      /etc/group

    • D.

      /etc/passwd

    • E.

      /etc/gshadow

    Correct Answer
    D. /etc/passwd
    Explanation
    The correct answer is /etc/passwd because this file contains the user account information, including the username, encrypted password, user ID, group ID, home directory, and shell. The group ID field in /etc/passwd determines the primary group for a user.

    Rate this question:

  • 47. 

    Which of the following commands should be added to /etc/bash_profile in order to change the language of messages for an internationalized program to Portuguese (pt)?

    • A.

      Export LANGUAGE=”pt”

    • B.

      Export MESSAGE=”pt”

    • C.

      Export UI_MESSAGES=”pt”

    • D.

      Export LC_MESSAGES=”pt”

    • E.

      Export ALL_MESSAGES=”pt”

    Correct Answer
    D. Export LC_MESSAGES=”pt”
    Explanation
    The correct answer is to add the command "export LC_MESSAGES=”pt”" to the /etc/bash_profile file. This command sets the LC_MESSAGES environment variable to "pt", which specifies the language of messages for internationalized programs to Portuguese.

    Rate this question:

  • 48. 

    In which file, if present, must all users be listed that are allowed to use the cron schedulingsystem? (Specify the full name of the file, including path.)

    Correct Answer
    /etc/cron.allow
    Explanation
    The correct answer is /etc/cron.allow. This file, if present, lists all the users who are allowed to use the cron scheduling system. It serves as a whitelist, allowing only the specified users to schedule cron jobs. If this file is not present, all users are allowed to use the cron system by default.

    Rate this question:

  • 49. 

    Which commands can be used to change a user’s account aging information? (Choose THREE correct answers.)

    • A.

      Usermod

    • B.

      Passwd

    • C.

      Chattr

    • D.

      Chage

    • E.

      Chsh

    Correct Answer(s)
    A. Usermod
    B. Passwd
    D. Chage
    Explanation
    The commands "usermod", "passwd", and "chage" can be used to change a user's account aging information. "usermod" is used to modify user account details, including aging information. "passwd" is used to change a user's password, which can also affect the account aging information. "chage" is used to change the user's password expiry information, such as setting the maximum number of days before the password must be changed.

    Rate this question:

  • 50. 

    Which command is used to add an empty group to the system? (Specify ONLY the command without any path or parameters.)

    Correct Answer(s)
    groupadd
    Explanation
    The command "groupadd" is used to add an empty group to the system. This command allows the creation of a new group without any users initially assigned to it. It is commonly used in Linux operating systems to manage user groups and their permissions.

    Rate this question:

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.