Thursday, July 2, 2026
HomeData Modelling & AIAlgorithms Quiz | Sudo Placement : Set 1 | Question 8

Algorithms Quiz | Sudo Placement : Set 1 | Question 8

Here are the two concurrent process P1, P2 with respective codes:
P1 code:

while (true) // infinite condition
{
A :____;
printf("%d", 1);
printf("%d", 1);
B:____;
}

P2 code:

while (true) // infinite condition
{
C:____;
printf("%d", 0);
printf("%d", 0);
D:____;
}

What should be the binary semaphore operation on A,B,C,D respectively and what must be the initial values of semaphore M,N inorder to get the output 110011001100….?
Where P is down and V is up operation respectively.
(A) A = P(N), B = V(M), C = P(M), D = V(N); M = 0, N = 1;
(B) A = P(N), B = V(M), C = P(M), D = P(N); M = N = 1;
(C) A = P(N), B = V(N), C = P(M), D = V(M); M = 1, N = 0;
(D) A = P(N), B = V(N), C = P(M), D = V(M); M = N = 1;

Answer: (A)
Explanation:
Quiz of this Question

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32519 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6900 POSTS0 COMMENTS
Nicole Veronica
12015 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12110 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6966 POSTS0 COMMENTS