Operating System homework Help at TutorEye

Best Homework Help For Operating System

Our experts are available 24/7 to help you with Operating System

Top Questions

5.In this problem and the next one, we’re going to make a very simple spam checker program by just looking ...

ooking at how likely a given email is to be spam based on the words it contains. In particular, in this problem we’re going to count how often words are present in spam emails within some set of training data (which here means a set of emails that have already been marked as spam or not spam manually). We have already started to write a function spam_score(spam_file, not_file, word), which takes in two filenames, along with a target word (a lowercase string). Both filenames refer to text files which must be in the same directory as hw07.py (we’ve provided several such files in hw07files.zip). The text files contain one email per line (really just the subject line to keep things simple) - you can assume that these emails will be a series of words separated by spaces with no punctuation. The first file contains emails that have been identified as spam, the second contains emails that have been identified as not spam. Since you haven’t learned File I/O yet, we’ve provided code that opens the two files and puts the data into two lists of strings (where each element is one line - that is, one email). You then must complete the function, so that it returns the spam score for the target word. The spam score is an integer representing the total number of times the target word occurs across all the spam emails, minus the total number of times the word occurs in not-spam emails. Convert all words to lowercase before counting, to ensure capitalization does not throw off the count.
View More

Operating System: 

 

Operating System is system software and is used to manage resources (both software and hardware) moreover, it provides services to the computer programs. It acts as an interface between the user and computer hardware. Some common examples of Operating systems are Microsoft Windows, Android, iOS, Linux, etc.

 

 

Operating System Sample Questions:

 

 

Question 1: Which of the following is not true about Kernel in the context of an Operating System?

 

A) It is responsible for managing system resources 

B) It acts as a bridge between computer hardware and application

C) It is loaded before the bootloader 

D) None of these

 

Answer: It is loaded before the bootloader 

Explanation: The following statements are true about kernel in the context of an Operating System:
It is responsible for managing system resources 
It acts as a bridge between computer hardware and application
It is one of the first programs to load on the startup but loaded after the bootloader
It manages system resources

 

Get the full solution!

 

 

Question 2: Which of the following system call can create a new process in Unix?

 

A) new 

B) create 

C) fork 

D) None of these


Answer: fork 

Explanation: In Unix, fork() system call can be used to create a new process. It returns the Process ID of the child process which is created.

 

 

Get the full solution!

 

 

Question 3: Which of the following is not contained in the process stack?

 

A) Program Instructions

B) Function Parameters

C) Local Variables which are declared inside the function

D) None of these

Answer: None of these

Explanation: Process stack contains:
Local Variables which are declared inside the function
Function Parameters 
Dynamically allocated memory 
Global variables
Program Instructions

 

 

Get the full solution!


 

Question 4: Which of the following is a valid reason for using a scheduling algorithm?

 

A) For increasing turnaround time

B) For increasing response time

C) For increasing waiting time

D) None of these


Answer: None of these

Explanation: Valid reasons for using scheduling algorithm:
For decreasing turnaround time
For decreasing response time
For decreasing waiting time

 

 

Get the full solution!


 

Question 5: Which of the following is true about round robin?

 

A) It is a preemptive scheduling algorithm

B) As compared to FCFS it has more response time

C) For a long time quantum value, Round Robin behaves like FCFS

D) None of these

 

Answer: As compared to FCFS it has more response time

Explanation: The following statements are true about the Round Robin scheduling algorithm:
It is a preemptive scheduling algorithm
As compared to FCFS, Round Robin has less response time if the time quantum is less. It is because it is preemptive.
For a long time quantum value, Round Robin behaves like FCFS 

 

 

Get the full solution!


 

Question 6: Which scheduler is responsible for selecting the process from the ready queue and scheduling it on the running state?

 

A) Short Term Scheduler

B) Long Term Scheduler

C) Medium Term Scheduler

D) All of these


Answer: Short Term Scheduler

Explanation: Short Term Scheduler: It is responsible for selecting the process from the ready queue and scheduling it on the running state
Long Term Scheduler: It is responsible for bringing new processes to the ready state
Medium Term Scheduler: It is responsible for suspending and then resuming the process

 

 

Get the full solution!


 

Question 7: Which of the following is not a process state?

 

A) New

B) Wait

C) Suspend Ready

D) None of these

 

Answer: None of these

Explanation: There are the following valid states a process can have:
New
Ready
Running
Terminate
Wait / Block
Suspend Ready
Suspend Block
 

 

Get the full solution!


 

Question 8: The Process Control Block is a?

 

A) Data Structure

B) Variable of type process

C) A block in the memory

D) None of these

 

Answer: Data Structure

Explanation: Process Control Block is a Data Structure used by the Operating System to store all the information about a process.

 

 

Get the full solution!

 


Question 9: In which of the following cases in dining philosophers problem deadlock will occur?

 

A) 5 chopsticks and 6 philosophers

B) 5 chopsticks and 5 philosophers

C) 5 chopsticks and 7 philosophers

D) None of these


Answer: 5 chopsticks and 5 philosophers

Explanation: Each philosopher will have one chopstick and will wait for neighbours to release a chopstick, this will cause a deadlock.

 

 

Get the full solution!


 

Question 10: Semaphores are used to implement which of the following?

 

A) Interprocess Communication mechanisms

B) System Protection

C) System Calls

D) None of these

 

Answer: Interprocess Communication mechanisms

Explanation: Semaphores are used to implement Interprocess Communication mechanisms and are capable of solving mutual exclusion, race condition, and process synchronization.


 

Get the full solution!

 

 

Computer Science Question Answers Pages


 

Programming in C and C Plus Plus Programming in Java Internet Programming
Screen Readers Android Programming Programming in Python C Sharp Programming