Question

- Question 3. [25 marks] Consider the execution of the following function (written in the C language). void test() { int a=1;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

3a void test) as! P3 torki); a: 3 if(fork) :-) if (togels--0) asa* 3 1 La 9. اما =) a=9. Pf(la:)? Printf(la : 73. forked will

note: Output 3 9 9 9 means

La:3

La:9

La:9

La:9

All the statement inside printf will be printed exactly.

Add a comment
Know the answer?
Add Answer to:
- Question 3. [25 marks] Consider the execution of the following function (written in the C...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider the following program: 1int main) 2nt count1; 3 int pid 0,pid2-0 4if ((pid - fork))) cou...

    Consider the following program: 1int main) 2nt count1; 3 int pid 0,pid2-0 4if ((pid - fork))) count-count 2; printf("%d ", count); 8 if (count 1) count++ pid2-fork) printf("%d ", 12 13 14 if(pid2){ 15 16 17 18 19 > count); wa i tpid(pid2, NULL, θ); countcount*2; printf("%d ", count); a. How many processes are created during the execution of this program? Explain b. List all the possible outputs of the program c. If we delete line 15 (the waitpid) show...

  • please explain very well.Thanks Question 3) What is the output of the following code? (4 marks)...

    please explain very well.Thanks Question 3) What is the output of the following code? (4 marks) #include <stdio.h> int main(void) Output: int i; for (i = 0;i<4; i++) static int a = 0; int b = 0; a++; b++; printf("%d %d", a,b); 11213141

  • Please answer the following question in C++ language Consider the following set of processes, with the...

    Please answer the following question in C++ language Consider the following set of processes, with the length of the CPU burst time given in milliseconds: Process            Burst Time      Priority P1. 7 5 P2 2 4 P3 11 3 P4 9 1 P5 5 3 The processes are assumed to have arrived in the order P1,P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive...

  • C++ code... Need help asap QUESTION 2 (20 MARKS) The following program shows a simple example...

    C++ code... Need help asap QUESTION 2 (20 MARKS) The following program shows a simple example to calculate average of three marks. Explain how the program is working as well as data management in your memory. You can illustrates this by using table or drawing. The sample output is illustrated in Figure Q2. 1 #include <iostream> 2 using namespace std 3 float calculateAverage (int* marks) int sum=0; float average, for (int İzd ;ia;i++) sumesum+( (marks+i)12 10 11 average float (sum)...

  • Consider the following program written in C syntax:

    Question 4: Consider the following program written in C syntax:void swap(int a, int b) { int temp;temp = a; a = b;b = temp;}void main() {int value = 4, list[5] = {1, 3, 5, 7, 9}; swap(value, list[0]);swap(list[0], list[1]); swap(value, list[value]);}For each of the following parameter-passing methods, what are all of the values of the variables value and list after each of the three calls to swap?1.  Passed by value2.  Passed by reference3.  Passed by result   By valueBy referenceBy result Output 

  • (d) Pre-emptive priority scheduling [4 marks]: Consider the following set of processes, with the length of...

    (d) Pre-emptive priority scheduling [4 marks]: Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Priority Arrival Time P1 8 3 0 P2 3 4 1 P3 6 2 3 P4 3 1 5 P5 1 5 7 P6 3 8 14 P7 8 5 18 (d-1) Draw Gantt chart illustrating the execution of these processes using pre-emptive priority (a smaller priority number implies a higher priority) [2 marks] 00   01  ...

  • QUESTION 1 Consider the following set of processes, with the length of the CPU burst time...

    QUESTION 1 Consider the following set of processes, with the length of the CPU burst time given in milliseconds: Process            Burst Time      Priority P1                    7                      5 P2                    2                      4 P3                    11                    3 P4                    9                      1 P5                    5                      3 The processes are assumed to have arrived in the order P1,P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 2). b. What...

  • QUESTION 3 Consider the following set of processes: Priority Process Arrival Time A 0 B 1...

    QUESTION 3 Consider the following set of processes: Priority Process Arrival Time A 0 B 1 C 6 * Lower number means higher priority Burst Time (ms) 5 3 4 Draw in a paper sheet 4 Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, Non-Preemptive SJF, Shortest-Remaining-Time-First (SRTF), Non-Preemptive Priority (NPP), and RR (quantum time = 2) scheduling algorithms, then fill the following tabic accordingly. (Note: If a new process arrives at the...

  • Question 3 Predict the output of the following C program: #include <stdio.h> void main() { int...

    Question 3 Predict the output of the following C program: #include <stdio.h> void main() { int i = 0; for(; 1; i++){ printf("%d",i); if(i==7) break; } 12pt Paragraph 1 Β Ι Ο Αν και Ta

  • Consider the following program written in C syntax int a , b , c ; //...

    Consider the following program written in C syntax int a , b , c ; // first declaration void g() { print(a,b,c); } int f(int a) // parameter declaration { int b; // second declaration b = a + 1; g(); // first call { int a; // third declaration int c; // fourth declaration c = b; a = b + c; g(); // second call } g(); // third call return a + b ; } int main()...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT