Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
bc is a command-line calculator that supports arbitrary precision and floating-point arithmetic.
Question 8 of 60 · bc · Easy
Which feature makes bc more capable than expr for arithmetic?
Not quite. Try another option.
Answer: It supports floating-point numbers
Unlike expr, which handles only integers, bc can perform floating-point (decimal) calculations.
Question 9 of 60 · expr · Easy
What type of arithmetic does the expr command primarily evaluate?
Not quite. Try another option.
Answer: Integer arithmetic
The expr command evaluates expressions, mainly performing integer arithmetic and simple string operations.
Question 10 of 60 · expr · Easy
What is the result of the command expr 5 + 3?
Not quite. Try another option.
Answer: 8
expr evaluates the integer expression 5 + 3 and outputs the sum 8. Spaces around operators are required.
Question 11 of 60 · script · Easy
What does the script command do?
Not quite. Try another option.
Answer: Records a typescript of a terminal session
The script command captures everything displayed in a terminal session and saves it to a file (default typescript).
Question 12 of 60 · passwd · Easy
What is the passwd command used for?
Not quite. Try another option.
Answer: Changing a user's password
The passwd command allows a user to change their login password (or an admin to change another user's password).
Question 13 of 60 · who · Easy
What does the who command display?
Not quite. Try another option.
Answer: Users currently logged into the system
The who command lists the users who are currently logged in, along with their terminal and login time.
Question 14 of 60 · whoami · Easy
What does the whoami command output?
Not quite. Try another option.
Answer: The username of the current user
The whoami command prints the effective username of the person currently running the shell.
Question 15 of 60 · uname · Easy
What does the uname command display by default?
Not quite. Try another option.
Answer: The operating system kernel name
By default, uname prints the kernel name (for example, Linux).
Question 16 of 60 · uname -a · Easy
What does the option -a do when used with uname?
Not quite. Try another option.
Answer: Displays all system information
uname -a prints all available system information, including kernel name, hostname, kernel version, and architecture.
Question 17 of 60 · uptime · Easy
What information does the uptime command provide?
Not quite. Try another option.
Answer: How long the system has been running
The uptime command shows how long the system has been running, the number of users, and the load averages.
Question 18 of 60 · tty · Easy
What does the tty command display?
Not quite. Try another option.
Answer: The filename of the current terminal
The tty command prints the file name of the terminal connected to standard input (for example, /dev/pts/0).
Question 19 of 60 · stty · Easy
What is the stty command used for?
Not quite. Try another option.
Answer: Changing and printing terminal line settings
The stty command displays or changes terminal (tty) line settings, such as erase and kill characters.
Question 20 of 60 · man command and manual page navigation · Easy
Which key is commonly used to quit a manual page opened with man?
Not quite. Try another option.
Answer: q
Manual pages are viewed with a pager (like less); pressing q quits and returns to the shell prompt.
Question 21 of 60 · Command Structure · Medium
In the command ls -l -a /home, which part represents the arguments (as opposed to options)?
Not quite. Try another option.
Answer: /home
A command structure is command [options] [arguments]. Here ls is the command, -l and -a are options (flags), and /home is the argument on which the command operates.
Question 22 of 60 · cal · Medium
Which command displays the calendar for the entire year 2024?
Not quite. Try another option.
Answer: cal 2024
Passing a single number that is a valid year (like cal 2024) makes cal display all 12 months of that year. Providing month and year (cal 5 2024) shows only one month.
Question 23 of 60 · date · Medium
What does the command date +"%Y-%m-%d" output?
Not quite. Try another option.
Answer: The date formatted as 2026-09-25
The + introduces a format string. %Y is the 4-digit year, %m the 2-digit month, and %d the 2-digit day, producing output like 2026-09-25.
Question 24 of 60 · echo · Medium
Which option allows echo to interpret escape sequences such as \n (newline)?
Not quite. Try another option.
Answer: echo -e
By default echo prints escape sequences literally. The -e flag enables interpretation of backslash escapes like \n and \t. -n suppresses the trailing newline, and -E disables interpretation.
Question 25 of 60 · printf · Medium
What is the output of printf "%.2f\n" 3.14159?
Not quite. Try another option.
Answer: 3.14
The format specifier %.2f prints a floating-point number rounded to 2 decimal places, so 3.14159 becomes 3.14.
Question 26 of 60 · bc · Medium
Which command computes to give the result 2.50?
Not quite. Try another option.
Answer: echo "scale=2; 5/2" | bc
By default bc truncates division of integers to 2. Setting scale=2 specifies 2 digits after the decimal point, giving 2.50. There is no precision keyword in bc.
Question 27 of 60 · expr · Medium
What is the result of expr 10 % 3?
Not quite. Try another option.
Answer: 1
The % operator in expr returns the remainder of integer division. since .
Question 28 of 60 · expr · Medium
Why does expr 5 * 3 often produce an error in the shell?
Not quite. Try another option.
Answer: The * is interpreted by the shell as a wildcard and must be escaped
The shell expands * as a filename wildcard before expr sees it. It must be escaped as \* or quoted, e.g. expr 5 \* 3, to perform multiplication.
Question 29 of 60 · script · Medium
What is the primary purpose of the script command?
Not quite. Try another option.
Answer: To record a terminal session, including input and output, into a file
The script command makes a typescript (log) of everything displayed in the terminal. It is used to capture sessions, not to run or create shell scripts. Type exit to stop recording.
Question 30 of 60 · passwd · Medium
When a regular (non-root) user runs passwd with no arguments, what happens?
Not quite. Try another option.
Answer: It prompts to change that user's own password
Running passwd without arguments lets a user change their own password (after confirming the current one). Only root can change other users' passwords with passwd username.
Question 31 of 60 · who · Medium
Which command shows a list of all users currently logged into the system?
Not quite. Try another option.
Answer: who
The who command lists all currently logged-in users with details such as terminal and login time. whoami prints only the effective username of the current session.
Question 32 of 60 · whoami · Medium
How does whoami differ from who am i?
Not quite. Try another option.
Answer: whoami prints the effective user ID name; who am i prints login session details of the current terminal
whoami outputs just the effective username. who am i (a form of who) shows the current terminal's login record including name, tty, and login time.
Question 33 of 60 · uname · Medium
What does the bare command uname typically print?
Not quite. Try another option.
Answer: The kernel name (e.g., Linux)
Without options, uname prints only the kernel name, such as Linux. Other details like version (-v), hostname (-n), and architecture (-m) require specific flags.
Question 34 of 60 · uname -a · Medium
What information does uname -a provide compared to plain uname?
Not quite. Try another option.
Answer: All available system info: kernel name, hostname, kernel version, and architecture
The -a (all) flag makes uname print every field: kernel name, network node hostname, kernel release, kernel version, hardware, processor, and OS. Plain uname shows only the kernel name.
Question 35 of 60 · uptime · Medium
In the output of uptime, what do the three numbers after "load average" represent?
Not quite. Try another option.
Answer: System load over the last 1, 5, and 15 minutes
The uptime load average shows the average number of processes waiting to run over the last 1, 5, and 15 minutes, indicating recent system demand.
Question 36 of 60 · tty · Medium
What does the tty command print?
Not quite. Try another option.
Answer: The filename of the terminal connected to standard input (e.g., /dev/pts/0)
The tty command reports the device file name of the terminal attached to standard input, such as /dev/pts/0. If input is not a terminal, it prints not a tty.
Question 37 of 60 · stty · Medium
Which command displays the current terminal line settings, including baud rate and control characters?
Not quite. Try another option.
Answer: stty -a
The stty -a command prints all current terminal settings in a readable format, including speed, control characters (like intr and erase), and modes.
Question 38 of 60 · man command and manual page navigation · Medium
While viewing a man page, which key is used to search forward for a pattern?
Not quite. Try another option.
Answer: / followed by the pattern
Man pages use the less pager. Pressing / then typing a pattern searches forward, while ? searches backward. Press n for the next match and N for the previous.
Question 39 of 60 · man command and manual page navigation · Medium
What is the purpose of the section number in a command like man 5 passwd?
Not quite. Try another option.
Answer: It specifies which manual section to look in (here, file formats)
Manual pages are organized into numbered sections. Section 1 is user commands, while section 5 covers file formats. man 5 passwd shows the /etc/passwd file format, not the passwd command.
Question 40 of 60 · echo · Medium
Given the variable assignment name=Alice, what does echo "Hello $name" output?
Not quite. Try another option.
Answer: Hello Alice
Inside double quotes, the shell performs variable expansion, so $name is replaced by its value Alice, producing Hello Alice. Single quotes would have printed $name literally.
Question 41 of 60 · Command Structure · Hard
Consider the command ls -l -a /home versus ls -la /home. Which statement about Unix command structure is most accurate?
Not quite. Try another option.
Answer: Both are equivalent because short options can be grouped after a single hyphen
In standard Unix command syntax, multiple single-character options can be bundled behind one hyphen, so -l -a and -la produce identical behavior. Argument order between options and operands like /home does not matter here.
Question 42 of 60 · cal · Hard
The command cal 9 1752 on many Unix systems shows September 1752 missing 11 days (3rd to 13th). What is the reason?
Not quite. Try another option.
Answer: The adoption of the Gregorian calendar dropped those days
In 1752 the British Empire switched from the Julian to the Gregorian calendar, removing 11 days. cal faithfully reproduces this historical calendar change.
Question 43 of 60 · date · Hard
What does date -d "next friday" +%Y-%m-%d output when run on a Friday?
Not quite. Try another option.
Answer: The date of the following Friday (7 days later)
GNU date interprets "next friday" as the next occurrence strictly after today, so on a Friday it returns the Friday a week ahead, formatted as YYYY-MM-DD.
Question 44 of 60 · echo · Hard
Given echo -e "a\tb\nc", assuming -e is honored, how many lines and what layout appear?
Not quite. Try another option.
Answer: Two lines: a<tab>b then c
With -e, \t becomes a tab and \n a newline. So a and b sit on line one separated by a tab, and c moves to line two.
Question 45 of 60 · printf · Hard
What does printf "%05.2f\n" 3.14159 output?
Not quite. Try another option.
Answer: 03.14
%05.2f means minimum field width 5, zero-padded, with 2 decimal places. 3.14159 rounds to 3.14 (4 chars) and is padded to width 5 with a leading zero: 03.14.
Question 46 of 60 · bc · Hard
Why does echo "10/3" | bc return 3 while echo "scale=4; 10/3" | bc returns 3.3333?
Not quite. Try another option.
Answer: Default scale is 0, so division truncates to an integer
bc uses scale to set the number of decimal digits after division. Its default is 0, giving 3. Setting scale=4 yields four decimal places, 3.3333.
Question 47 of 60 · expr · Hard
What is the result of expr 5 \* 3 and why is the backslash needed?
Not quite. Try another option.
Answer: 15; the backslash prevents the shell from expanding * as a glob
* is a shell wildcard, so it must be escaped (\*) or quoted to reach expr intact. expr then performs multiplication, yielding 15.
Question 48 of 60 · expr · Hard
What does expr length "hello world" return, and what does it demonstrate about expr?
Not quite. Try another option.
Answer: 11; expr counts all characters including the space
expr length STRING returns the character count of the whole string. "hello world" has 11 characters including the embedded space.
Question 49 of 60 · script · Hard
A user runs script session.log, executes commands, then forgets to type exit. What is the consequence?
Not quite. Try another option.
Answer: The log keeps recording until the shell ends, then is saved
script records everything in the subshell to the typescript file. Recording stops and the file is finalized only when that subshell terminates (via exit, EOF, or the shell closing).
Question 50 of 60 · passwd · Hard
A non-root user runs passwd anotheruser. What is the most likely outcome?
Not quite. Try another option.
Answer: Permission denied because only root may change another user's password
Ordinary users can only change their own password. Specifying another username requires root privileges, so the attempt is rejected for a non-privileged user.
Question 51 of 60 · who · Hard
How does the output of who am i differ from whoami?
Not quite. Try another option.
Answer: who am i shows the login line, terminal, and login time; whoami shows only the effective username
who am i (a special use of who) prints the current login session details including tty and login time, while whoami prints only the effective user name.
Question 52 of 60 · whoami · Hard
After running sudo whoami in a terminal logged in as user alice, what is printed?
Not quite. Try another option.
Answer: root, because whoami reports the effective user ID
whoami reports the effective UID. Under sudo, the effective user becomes root, so it prints root even though the real (login) user is alice.
Question 53 of 60 · uname · Hard
Why might uname -m return x86_64 while a 32-bit program still runs fine on the same machine?
Not quite. Try another option.
Answer: uname -m reports hardware architecture, which can run compatible 32-bit binaries
uname -m reports the machine hardware name (x86_64). 64-bit x86 CPUs and kernels retain backward compatibility, so 32-bit binaries still execute when the needed libraries are present.
Question 54 of 60 · uname -a · Hard
Which fields does uname -a combine that individual uname flags would otherwise require multiple invocations to obtain?
Not quite. Try another option.
Answer: Kernel name, hostname, kernel release, version, machine, and OS
uname -a prints all available system information in one line: kernel name (-s), node/hostname (-n), release (-r), version (-v), machine (-m), and operating system (-o).
Question 55 of 60 · uptime · Hard
The uptime output ends with load average: 4.00, 2.00, 1.00 on a 4-core system. What is the correct interpretation?
Not quite. Try another option.
Answer: The 1-minute load fully saturates all 4 cores while longer averages show it was lighter before
Load average counts runnable/running processes. On 4 cores, a 1-minute load of 4.00 means full saturation (one per core), while 2.00 and 1.00 show lighter load over the past 5 and 15 minutes.
Question 56 of 60 · tty · Hard
Running tty inside a script whose input is redirected from a file (./script < input.txt) is likely to print what?
Not quite. Try another option.
Answer: not a tty and return a non-zero exit status
tty prints the terminal connected to standard input. When stdin is redirected from a file, there is no terminal, so it prints not a tty and exits with a non-zero status.
Question 57 of 60 · stty · Hard
A terminal displays typed characters twice or behaves oddly after a program crash. Which command best restores sane settings?
Not quite. Try another option.
Answer: stty sane
stty sane resets terminal line settings to reasonable defaults, fixing echo, line-editing, and mode problems left behind by a misbehaving program.
Question 58 of 60 · stty · Hard
What is the effect of stty -echo followed by reading input, and why is it commonly used?
Not quite. Try another option.
Answer: Typed characters are not displayed, useful for password entry
stty -echo disables echoing of typed characters. Scripts use it to hide sensitive input like passwords; stty echo restores normal display afterward.
Question 59 of 60 · man command and manual page navigation · Hard
You want the manual entry for the printf C library function, but man printf shows the shell command. Which command targets the C function?
Not quite. Try another option.
Answer: man 3 printf
Manual pages are organized in sections; section 3 covers C library functions. man 3 printf selects the library function page instead of the section 1 command page.
Question 60 of 60 · man command and manual page navigation · Hard
Inside man's pager, you type /socket then press n twice. What happens?
Not quite. Try another option.
Answer: It searches forward for socket and jumps to the third match
In the less-based pager, /pattern searches forward and lands on the first match; each n advances to the next match. Two n presses move to the third occurrence overall.
That's unit 2
Answer a few questions and your score shows up here.
Nearly through. Did unit 2 of CSE105 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 2 of CSE105 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.