The correct answer to this question is A. One level or record an be returned in a single query when a developer writes a SOQL query to find child records for a specific parent.
Answer:
b) Bounded Waiting
Explanation:
int currentThread = 1;
bool thread1Access = true;
bool thread2Access = true;
thread1 { thread2 {
While (true) {
While (true)
{
while(thread2Access == true)
{
while(thread1Access == true)
{
If (currentThread == 2) {
If (currentThread == 1)
{
thread1Access = false; thread2Access = false;
While (currentThread == 2);
While (currentThread == 1);
thread1Access = true; thread2Access = true;
} }
/* start of critical section */ /* start of critical section */
currentThread = 2 currentThread = 1
… ...
/* end of critical section */ /* end of critical section */
thread1Access = false; thread2Access = false;
… ...
} }
} }
} }
It can be seen that in all the instances, both threads are programmed to share same resource at the same time, and hence this is the bounded waiting. For Mutual exclusion, two threads cannot share one resource at one time. They must share simultaneously. Also there should be no deadlock. For Progress each thread should have exclusive access to all the resources. Thus its definitely the not the Progress. And hence its Bounded waiting.
Answer:
Step by step explanation along with C++ code is provided below.
C++ Code:
#include <iostream>
using namespace std;
int main()
{
int numRows;
int numCols;
int r = 1;
cout <<"Please enter no. of rows"<<endl;
cin>>numRows;
cout <<"Please enter no. of columns"<<endl;
cin>>numCols;
cout<<"Seating arrangement in the theater:"<<endl;
for(int i = 0; i < numRows; i++)
{
char c = 'A';
for(int j = 0; j < numCols; j++)
{
cout <<r << c << " ";
c= c + 1;
}
r= r + 1;
}
return 0;
}
Explanation:
// the outer loop prints the rows
// counter r = r + 1 increments the rows
// the inner loop prints columns
// counter c = c + 1 increments the columns
// int r = 1 ensures that rows starts from 1
Output:
The program is tested multiple times and is working correctly for any number of rows and columns
Please enter no. of rows
2
Please enter no. of columns
3
Seating arrangement in the theater:
1A 1B 1C 2A 2B 2C