TCS Placement: Sample Questions 404 - 406 of 502

Get unlimited access to the best preparation resource for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 404

Edit

Write in Short

Short Answer▾

A college has 10 basketball players. A 5-member team and a captain will be selected out of these 10 players. How many different selections can be made?

Explanation

We have to select 5 members team from 10 basketball players.

We can select them in 10C5 ways

We have to select one captain from remaining 5 players.

We can select this in 5C1 way = 5

Therefore, total ways of the selection of 5 players and one captain will be .

Question 405

Edit

Write in Short

Short Answer▾

What is difference between System. String and System. StringBuilder classes?

Explanation

Difference between System. String and System. String Builder
System. StringSystem. StringBuilder
String is immutableString builder is mutable
Immutable means once we create string object we cannot modifyMutable means once we create string builder object we can perform any operation like insert, replace or append without creating new instance for every time.
String doesn՚t have append keywordStringBuilder has append keyword
String belongs to System namespaceStringBulider belongs to System. Text namespace

Question 406

Edit

Describe in Detail

Essay▾

List out some reasons for process termination.

Explanation

List out some reasons for process termination are as below:

  1. Normal completion
    • The process completes all task and releases the CPU.
    • The process executes an OS service call to indicate that it has completed running.
  2. Time limit exceeded
    • The process has run longer than the specified total time limit.
    • There are a number of possibilities for the type of time that is measured.
    • These include total elapsed time, amount of time spent executing and in the case of interactive process, and the amount of time since the user last provided any input.
  3. Memory unavailable

    A process requires more memory to execute but the system fails to provide enough memory to the process for its execution, and then the process needs to be terminated.

  4. Bounds violation

    The process tries to access a memory location that it is not allowed to access.

  5. Protection error

    Process wants to use a resource that is not allowed to use by that process. For example; if a process wants to WRITE on a file that is READ ONLY file.

  6. Arithmetic error
    • There is an instruction of a process that is invalid instruction than the process needs to be terminated.
    • For example, if a process wants to divide a number by zero.
  7. Time overrun
    • Waiting time is specified for a process that for how much time a process can wait for a resource.
    • In this time if the process fails to allocate a resource then the process needs to be terminated.
  8. I/O failure
    • When a process attempts to use an I/O device and I/O device is not working fine at the moment.
    • For example, a process that wants to print a file on the printer, but the printer is defective.
  9. Invalid instruction

    The process attempts to execute a nonexistent instruction

  10. Privileged instruction

    Processes try to execute an instruction that is reserved for only OS.

  11. Data misuse

    A piece of data is of the wrong type or is not initialized.

  12. Operator or OS intervention

    In some critical cases, OS take the control of the process and stops the execution of the process. For example, if a deadlock occurs, or deadlock can occur, then OS terminates the process.

  13. Parent termination

    When the parent is not in CPU, child process can՚t exist in CPU. So when a parent is terminated, child process also needs to be terminated.

  14. Parent request

    A parent process typically has the authority to terminate any of its offspring.

Developed by: