CLI Debugging u0026 Inspection Quiz Quiz

  1. Log Level Filtering

    Which command-line tool is commonly used to filter log files based on severity levels such as INFO, WARNING, and ERROR?

    1. grep
    2. sed
    3. awk
    4. tail -f
    5. less
  2. Following Logs

    Which command allows you to continuously monitor and display the end of a log file in real-time as new entries are added?

    1. tail
    2. head
    3. cat
    4. grep
    5. more
  3. Finding specific error

    In a large log file, what is the most efficient command to quickly find all lines containing the phrase 'NullPointerException'?

    1. find NullPointerException logfile.txt
    2. grep 'NullPointerException' logfile.txt
    3. less logfile.txt | search NullPointerException
    4. cat logfile.txt
    5. awk '/NullPointerException/' logfile.txt
  4. Standard Error Redirection

    Which redirection operator is used to redirect standard error (stderr) to a file?

    1. 1u003E
    2. 2u003E
    3. u003Eu00262
    4. u003E
    5. 2u003Eu00261
  5. Combined Output Redirection

    How can you redirect both standard output (stdout) and standard error (stderr) to a single file named 'output.log'?

    1. u003E output.log 2u003Eu00261
    2. 2u003E output.log 1u003Eu00261
    3. 2u003Eu00261 u003E output.log
    4. u003Eu0026 output.log
    5. output.log u003Eu0026 2
  6. Piping and grep

    What does the command 'program | grep -v 'debug'' do?

    1. Runs 'program' and displays only lines containing 'debug'.
    2. Runs 'program' and saves the output to a file named 'debug'.
    3. Runs 'program' and filters out lines containing 'debug'.
    4. Runs 'program' in debug mode.
    5. Runs 'program' but only if 'debug' is a valid argument.
  7. Awk for Data Extraction

    Which part of 'awk '{print $1}' logfile.txt' specifies the action to be performed on each matching line?

    1. awk
    2. print $1
    3. logfile.txt
    4. '{print $1}'
    5. $1
  8. Finding time difference

    What is a common CLI tool used to calculate the time difference between two log entries by extracting timestamp information?

    1. datecalc
    2. diff
    3. sed
    4. awk
    5. python
  9. Less Search

    Within the 'less' command, which key is used to initiate a forward search for a specific pattern?

    1. /
    2. n
    3. ?
    4. q
    5. f
  10. Identifying Slow Queries

    What is a practical way to identify slow-running database queries using CLI tools and log analysis, assuming queries are logged with execution times?

    1. Only searching for the word 'query'
    2. Using 'tail -f' on the database log file
    3. Grepping for queries with execution times exceeding a threshold.
    4. Deleting old log files
    5. Randomly sampling log entries.