Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the following C code for process P1 ... Start Learning for Free
Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)
P1               P2
if (a < 0)      b = 10;    
c = b-a;       a = -3;
else
c = b+a;
If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?
  • a)
    4
  • b)
    7
  • c)
    10
  • d)
    13
Correct answer is option 'C'. Can you explain this answer?
Most Upvoted Answer
Consider the following C code for process P1 and P2. a=4, b=0, c=0 (in...
P1 : 1, 3, 4 → c = 0+4 =4 {hence option a}
P2 : i, ii and P1 : 1, 2 → c = 10-(-3) = 13 {hence option d}
P1 : 1 , P2 : i, ii and P1 : 3, 4 → c= 10+(-3) = 7 { hence option b}
So 10 cannot be c value.
Free Test
Community Answer
Consider the following C code for process P1 and P2. a=4, b=0, c=0 (in...
It appears that the code got cut off. Could you please provide the complete code for both process P1 and P2?
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer?
Question Description
Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer?.
Solutions for Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer?, a detailed solution for Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer? has been provided alongside types of Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the following C code for process P1 and P2. a=4, b=0, c=0 (initialization)P1 P2if (a < 0) b = 10; c = b-a; a = -3;elsec = b+a;If the processes P1 and P2 executes concurrently (shared variables a, b and c), which of the following cannot be the value of ‘c’ after both processes complete?a)4b)7c)10d)13Correct answer is option 'C'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev