CSE 381 Exam 1

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Given the following code: std::vector args = {"cut", "-d", "~/temp.txt"}; What is the value stored in the val variable below? auto val = args[1];

"-d"

What does the 3rd tool do? (Gray folder with orange square in top right corner)

Adds an existing remote project to the workspace

In a 32-bit microprocessor, the virtual memory for a process is limited to 4 GB. Consequently the total virtual memory that the OS can access and manage is limited to...

Amount of space reserved for virtual memory on secondary storage

In C++, the destructor is automatically invoked when

An object goes out of scope

The expansion for the acronym API is...

Application Program Interface

What is the expansion of the acronym, API?

Application Program Interface

Many people find it challenging to adapt to the changing technology landscape. What are some of the common excuses that students/employees offer that suggests that they are merely struggling to adapt? For each one below, indicate "True" (if you think this is common excuse as indicated in the presentation) or "False" (otherwise) -I could have done it on a different OS... -I am sure I can get it done in a different programming language... -It is the IDE, but for the IDE I would have been successful... -It is my colleague who is causing me to fail...

-True -True -True -False

When listing files using the ls command on Linux, the correct combination of permission flags that indicate read & write for owner, read & execute for group, and read permission for others would be...

-rw r-x r--

When listing files using the ls command on Linux, the correct combination of permission flags that indicate read-&-execute for group members is...

-rw- r-x r--

In Linux, the user id for the special superuser login root is

0

In Linux, when a program completes successfully its exit code is

0

The OS internally uses numbers (aka files descriptors) to refer to all standard I/O streams. The fixed file descriptors number for std::cin is:

0

The minimum number of instance variables that must be present in a C++ class is

0 (no instance variables needed)

On a x86 processor, the value in AH register after the instruction MOV $0XABCD, %AX would be

0xAB

Given the following bash command, how many child processes are being multitasked? $ ls -lh > output.txt

1

In a modern quad-core, dual-CPU server the number of OS-kernel(s) running on the server would be

1

The OS internally uses numbers (aka file descriptors) to refer to all standard I/O streams. The fixed file descriptor number for std::cout is:

1

The minimum number of threads that are present in a standard process created by modern operating system would be

1

The process ID (PID) process started by Linux is...

1

The value stored in the variable result due to the following C++ language statement would be: int result = 3 % -2;

1

Four important design goals of a general purpose file system for a multi-user, multi-tasking operating system

1. Ease routine operations of creating files, deleting files, etc 2. Enable efficient use of storage while ensuring high I/O throughout 3. Provide fault tolerance while enabling full recovery from common problems and partial recovery from failures 4. Provide infrastructure for security and privacy

A computer with 1 GB of RAM is synonymous to a computer with

1024 MB of RAM

Given the following bash command, how many child processes are being multitasked? $ ls -lh | grep ".cpp"

2

Given the following bash command, how many child processes are being multitasted? $ ls -lh | tr -s " " | cut -d" " -f 5,9

3

On an x86 processor, if the memory address of an int variable is 32-bits, then the memory address of a short variable would be....

32-bits

Given the following code: std::vector args = {"cut", "-d", "~/temp.txt"}; What is the data type of the val variable below? auto val = &args[1][0];

A character pointer

Which one of the following is not a system -File system used to store data -A data communication network -A DBMS -Operating system

A data communication network

Which one of the following is not a system? -operating system -file system used to store data -database management system -a data communication network

A data communication network

Hypervisor

A program that emulates a virtual machine on which an operating system can run

An application that would significantly benefit by running in batch processing mode would be...

A program to compute the billionth digit of the irrational constant pi

The smallest unit of data that can be physically read from spinning storage media is

A sector

"Race Condition"

A semantic error in a multi-threaded program, where two or more threads modify a shared memory location causing inconsistent changes to shared values.

Two-stage boot loading

A sequence of 2 boot loaders that collaboratively load an OS. The first stage is simpler and loads the second stage boot.

From an OS perspective, what is an "interrupt"?

A signal indicating some I/O operation is complete

An application what would significantly benefit by running in batch processing mode would be

A simple program to multiply several large matrices

The first stage boot loader of an OS is loaded by...

BIOS

When a computer is powered on, the first program that starts running is...

BIOS

What is the expansion of the acronym "BIOS"?

Basic Input Output System

Given a specific command-line argument supplied to the execvp system call, how does the operating system determine the end of each string in the command-line arguments?

By looking for '\0'

What is the most energy-efficient programming language?

C++

First study of the following code fragment that creates 2 file streams: std::ofstream log("log.txt"); int pid = fork(); std::ifstream info("input_data.txt"); Given the above code fragment, which of the following applies to the info stream?

The info stream is separate (not shared and valid in both parent and child processes)

An array of command-line arguments must be supplied as the second parameter of the execvp system call. How should the array of command-line arguments be terminated

The last argument should be nullptr

The virtual memory subsystem of an OS also manages

The main memory (RAM)

The BIOs ParameterBlock (BPB) for a FAT-12 file system is stored on disk in the...

The master boot record in the middle of the boot loader code

System call

The operation through which an user-application interacts with an OS

Assume a process consists of 3 threads, namely T1, T2, and T3 and the threads were started in the order T1, T2, and T3. The order in which the 3 threads will join is

The order in which threads will join is not deterministic

Given the following line of code below, which of the following statements is true: auto pid = fork();

The virtual memory address of pid is the same in parent and child

Two types of hypervisors

Type-1: runs directly on the bare hardware and there is no native/host operating system Type-2: runs on top of a native/host operating system and guest operating system runs within the virtual machine created by the Type-2 hypervisor

In the context of an OS, what is uid?

User ID (a number)

How does a system call operate

When a process makes a system call there is switch from user-space to kernel-space and the system call actually runs in kernel space. Once the OS has completed the system call it switches back to kernel-space

The pipe system (API: int pipe(int fd[]);) call fills-in file descriptors (i.e., numbers that the OS internally uses to refer to I/O streams) in the supplied array fd[]. After this system call, fd[1] corresponds to...

Write end of the pipe

The return value of the fork (system call) is

Zero in the child process Non-zero in the parent

The most concise definition of a mutable pointer (pointer can be changed to point elsewhere) to a constant integer value would be...

const int* ip;

The first system call that is typically reported for a program by strace is...

execve

Which of the following is a valid and a real infinite loop? -for(;;); -for(int i = 10; (i > 0); i++); -for(int i = -10; (i < 0); i--); -for(int i = 0; (i < 100000); i++);

for(;;);

Which of the following sequence of fork system calls correctly create the process hierarchy shown below. Assume the code starts running in the process at the root of the hierarchy () / \ () () / ()

fork(); fork();

What is the commonly used boot loader for Linux called?

grub

Which one of the following shows the correct formatting for a C++ if-statement

if (a < b) {

Which of the following sequence of fork system calls correctly create the process hierarchy shown below. Assume the code starts running in the process at the root of the hierarchy () / | \ () () ()

if (fork() != 0) { if (fork() != 0) { fork(); }}

Which of the following sequence of fork system calls correctly create the process hierarchy shown below. Assume the code starts running in the process at the root of the hierarchy () \ () / () \ ()

if (fork() == 0) { if (fork() == 0) { fork(); }}

In Linux (using System V), the root of the process tree always starts with a process named

init

The first process that is started by the Linux operating system is called

init

On x86 processors, the memory addressing mode to initialize a register with a constant values is called

Immediate mode

The execvp system call required pointers (or memory addresses for its operations because

It is a programming-language agnostic

The minimum requirement for an "open system" is

It produces some output (may not accept inputs)

In Linux, a name FIFO is represented as a file. So when data is written to the FIFO,

Its file size will remain zero

The design strategy used by the Linux kernel is...

Layered design

In the adjacent program calls to compute method take 5 min to complete. So, when the adjacent program is run, the line of code that will cause state to change from Running to Ready would be: int main() { double d = 0; double z0 = compute(); std::cin >> d; return 0; }

Line 2

When the program is run, the line of code that will cause state to change from Running to Blocked would be: int main() { double d = 0; double z0 = compute(); std::cin >> d; return 0; }

Line 3

In the code snippet, the last line of code... using IntVec = std::vector<int>; IntVec v1 = {2, 2, 2}; IntVec v2 = v1;

Makes v2 initialized to values of v1

Which one of the following is not a functionality of a conventional operating system: -Control access to RAM by various processes -Manage caches on a CPU -Facilitate copy-pasting information one process to another -Monitor and report selected statistics about operations of processes

Manage caches on a CPU

A structured thought process is critical for developing good, maintainable programs. A key indicator of lack of structured thinking is...

Methods longer than 25-lines of code

OS design involving a set of small interacting units and a small core kernel is called...

Microkernel

A suitable operating system design for a micro system on a chip (SoC) device is...

Monolithic Design

A Direct Memory Access (DMA) is a hardware device that is used to...

Move data from a device into main memory (RAM)

In the context of virtual memory, what is "swapping"?

Moving pages to/from RAM to disk

The most suitable operating system for a smart phone would be

Multi-processing operating system

The most suitable operating system for gaming consoles that run one game for a player would be

Multi-tasking operating system

Multi processing

Multiple processes run simultaneously and share resources on the computer system. Programs take turns running via context switching

Sometimes NetBeans shows red exclamation marks (!) on some of the lines of my source code, even though they are syntactically correct. This is because...

NetBean's code assistant is unable to help with that line

After successfully starting the specified program the execvp command

Never returns to the calling process

The minimum number of cores and CPUs that are required to run a multi-tasking operating system like Linux is...

One CPU with 1 core

Batch processing

One process is run at any time and has access to all of the computational resources on the machine. One program runs until completion and there is no context switching

Remote projects can be created in NetBeans via

Only by clicking one icon

when a pipe is used for IPC between 2 processes (e.g. ps - fea | grep emacs), it is important for the parent process to close the write-end because

Otherwise the 2nd process will not terminate as it is waiting for more inputs

All of us get only one chance to make a good "first impression". When your prospective employer looks at an example source code (or program) you have developed, the first thing that people see is:

Style and formatting

Calls to an OS's API are called...

System calls

At startup, device drivers for a Hard Disk Drive (HDD) are typically loaded by...

The OS after the kernel has already been loaded from the HDD

Multi-tasking

Several processes simultaneously run on the computer. Computational resources are shared between processes.

Inter-Process Communication (IPC) using pipes (named or anonymous) is fundamentally accomplished via

Shared memory

What is firmware?

Software on a chip, hardwired to a computer

In OS terminology, "device drivers" are...

Software used to interface OS to hardware

In C++ the >> operator is called

Stream extraction operator

Given a class named Element, which one of the following correctly reflects the requirements/mandates in the C++ language

The class can be defined in any source file, but the preferred source file name is Element.cpp

Which one of the following resources is not managed by the operating system -Memory used by a process -Space on a hard disk -Caches on the CPU -Printers connected to the computer

Caches on the CPU

The expansion of the acronym CPU is...

Central Processing Unit

Sometimes NetBeans shows red exclamation marks (!) on some of the lines of my source code, even though they are syntactically correct. If this issue persists the best way to resolve the issue would be...

Clear Code Assistance cache and restart

In a multiprocessing OS, the kernel allows processes to take turns at running (by using the CPU), via a special operation called

Context switching

A good example of a Task Parallel application would be...

Converting a video to MPEG4/H264, OGV, and MOV format

A good example of Data Parallel application would be...

Converting each pixel in a photo to black and white

The actual process ID of a child process created via fork syscall will be

Could be any integer value

Given an 8 core CPU the maximum number of threads that can be created in one single process is...

Depends on the maximum threads supported by OS

The primary motivation for systems programming is to

Develop software such as operating systems, web-servers, etc

The primary motivation for systems programming is to:

Develop software such as operating systems, web-servers, etc.

What does the 4th tool do? (Gray folder with little computer in bottom right corner)

Enable opening any file on the remote server

In the context of computer hardware, what is a BIOS?

First program that runs on a computer

The Master Boot Record (MBR) is stored on a Hard Disk Drive (HDD) in...

First sector

What is the expansion of the acronym, GNU?

GNU's Not Unix

The -Wall option to the GNU compilers (gcc/g++) is used to

Generate warnings that are potential sources of errors in the program

The process of connecting the output of one process as the input of another process is called

Pipeing

Which one of the following resources is not shared by default between multiple threads: -System heap -Program stack -Pipes and file handles -Program code

Program stack

What is the expansion of the acronym, RAM?

Random Access Memory

What does the 6th tool do? (Hammer with a brush)

Re-compiles all the source files

What is the expansion of the acronym "ROM"?

Read Only Memory

The pipe system (API: int pipe(int fd[]);) call fills-in file descriptors (i.e., numbers that the OS internally uses to refer to I/O streams) in the supplied array fd[]. After this system call, fd[0] corresponds to...

Read end of the pipe

The process of writing the output of a program to a file is called...

Redirection

On a computing system, the fastest memory that can be used by a program to store information is...

Registers

The fastest storage unit on a x86 CPU is

Registers

The exit code of a program is

Return value from main function

On modern CPUs, the kernel of an OS will run in a privileged mode called..

Ring 0

In Linux, when a program is run as a background process, it...

Runs normally, but cannot read input from the terminal

What does the 8th (last) tool do? (looks like a numbered list)

Runs the program in the debugger

In Linux, the default administrator user ID is

root

In C++, given constant objects, only constant methods can be called on the object. Given the following code fragment, which one of the following methods can be called on the str object? const std::string str = "Call me";

size_t size() const;

Which on of the following streams can be used for redirection or pipeing?

std::cout or std::cin

Given the following code: std::vector args = {"cut", "-d", "~/temp.txt"}; What is the data type of args[1]

std::string

In C++, given a class named Element, the destructor method for this class is

~Element() {}


Set pelajaran terkait

Life Insurance Test (completing the application, underwriting, and delivering the policy)

View Set

Aceable Agent - Law of Contracts

View Set

Mc Graw Hill: Vocabulary Review Africa

View Set

Muscle and Nervous Tissue Microanatomy

View Set

Unit Test: 4.13 Unit Test: Chemical Thermodynamics

View Set

Government Inquizitive Ch 4: Civil Liberties and Civil Rights

View Set

LQ6--Sagittal Brain(fig 13.9) CHAP-13 Quiz 10

View Set

Geology 101 Test 2-Knapp South Carolina

View Set