logo

Crowdly

Browser

Add to Chrome

Questions Bank (1461554 total)

The addresser's name goes under his/her signature.

0%
0%
View this question

Dado el siguiente programa, ¿qué afirmación es cierta?

1#include <iostream>

 

2class test {

3public:

4 test(bool b) noexcept : b_{b} {}

5 void func() noexcept

6 {

7 if (!b_) throw "Error en test::func";

8 }

9private:

10 bool b_;

11};

 

12int main() try

13{

14 test t(false);

15 t.func();

16 std::cout << "Fin del programa" << std::endl;

17} catch (const char* ex) {

18 std::cerr << ex << std::endl;

19}

0%
0%
0%
0%
View this question

¿En qué medida afecta la eficiencia a la corrección de un programa?

0%
0%
0%
0%
View this question

Dado el siguiente programa, ¿qué afirmación es cierta?

1#include <iostream>

 

2class test {

3public:

4 class Fallo{};

5 test(bool b) noexcept : b_{b} {}

6 ~test() noexcept(false) { if (!b_) throw Fallo(); }

7 void func() { if (!b_) throw Fallo(); }

8private:

9 bool b_;

10};

 

11int main() try

12{

13 test t(false);

14 t.func();

15 std::cout << "Fin del programa" << std::endl;

16} catch (const test::Fallo& ex) {

17 std::cerr << "Fallo detectado" << std::endl;

18}

100%
0%
0%
0%
View this question

Dado el siguiente programa, ¿que afirmación es cierta?

1#include<iostream>

 

2struct test {

3 test() noexcept {}

4 void func() { int i = 20; throw &i; }

5};

 

6int main ()

7{

8 try {

9 test t;

10 t.func();

11 } catch (const int& ex) {

12 std::cerr << "Excepción capturada" << std::endl;

13 }

14 std::cout << "Fin del programa" << std::endl;

15}

0%
0%
100%
0%
View this question

El uso de excepciones es la forma más adecuada de tratar...

0%
0%
0%
0%
View this question

Using the information in the table below, what is the parent process ID for the process that printed this table to the Linux shell?

A table of Linux process information

View this question

Suppose that a single-CPU system uses round robin scheduling with a time slice of 1 millisecond. The ready queue for this system always contains n processes that make no I/O requests, and the time taken to swap processes assigned to the CPU is negligible. A process (with a burst time of t milliseconds) arrives in the ready queue immediately after a process is assigned to the CPU. This newly arrived process eventually successfully terminates before any of the other processes. How long (in milliseconds) did the process take to execute in this system? 

0%
0%
0%
❌
View this question

 Suppose 2 programs -- A and B -- with service times 156 time units and 168 time units respectively, are executing on a system with a single CPU. The programs make no I/O requests.  Using a Round Robin policy with a time slice of 12 time units, the OS schedules the programs to run on the CPU -- program A runs first, then program B, then back to A, and so on. The OS uses timer interrupts to reassign the CPU from one program to another. 

Assume 1) no other program/OS activity consumes CPU cycles, 2) both programs will consume their service times and successfully terminate, and 3) no interrupts occur before the CPU executes the first instruction from program A. 

Based only on the information given, how many mode switches due to interrupts have occurred by the time program A has spent 155 time units running on the CPU?

0%
0%
0%
0%
0%
View this question

Under the 5-state process model, processes with IDs 3, 8, 13, 16 and 25 are executing on a system. They arrived in the ready queue in the order they are listed, starting with process 3. The processes do not fail and do not make I/O requests. The short-term scheduler uses the following preemptive priority scheduling algorithm (processes with larger priority numbers have higher priority):

- the process with the highest priority runs on the CPU (FCFS is used, in case of a tie);

- a process has priority 0 when it first enters the ready queue;

- the priorities of all processes in the ready queue continuously decrease at the same rate;

- the priority of the process running on the CPU also continuously decreases, but more slowly than the priorities for processes in the ready queue.

Based only on this information, what is the order in which the processes finish executing?

❌
❌
❌
✅
❌
View this question