What will be output of the following c code


Asked by admin @ in Computer Science viewed by 360 People


Q.16:What will be the output of the following C code? #include void main() { int x = 4, y, z; y =-

-X, Z = X--; printf("%d%d%d", x, y, z); }a) O 2 34b) 323c) O 233d) 0 322​

Answered by admin @



Answer:

pthread_mutex_t mut;

pthread_t thread[2];

int threads_joined = 0;

char * t1 = "Thread 1";

char * t2 = "Thread 2";

/*********************************************************************/

/* thread_cleanup: condition handler to clean up threads */

/*********************************************************************/

void thread_cleanup(_FEEDBACK *cond,_INT4 *input_token,

_INT4 *result, _FEEDBACK *new_cond) {

/* values for handling the conditions */

#define percolate 20

printf(">>> Thread_CleanUp: Msg # is %d\n",cond->tok_msgno);

if (!threads_joined) {

printf(">>> Thread_CleanUp: Unlocking mutex\n");

pthread_mutex_unlock(&mut);

printf(">>> Thread_CleanUp: Joining threads\n");

if (pthread_join(thread[0],NULL) == -1 )

perror("Join of Thread #1 failed");

if (pthread_join(thread[1],NULL) == -1 )

perror("Join of Thread #2 failed");

threads_joined = 1;

}

*result = percolate;

printf(">>> Thread_CleanUp: Percolating condition\n");

}

/*********************************************************************/

/* thread_func: Invoked via pthread_create. */

/*********************************************************************/

void *thread_func(void *parm)

{

printf(">>> Thread_func: %s locking mutex\n",parm);

pthread_mutex_lock(&mut);

pthread_mutex_unlock(&mut);

printf(">>> Thread_func: %s exitting\n",parm);

pthread_exit(NULL);

}


Similar Questions

What will be the output of following code

Asked by admin @ in Computer Science viewed by 417 persons

What will be the output of the following code? print( (3 < 1) and (4/0 > 1))1.False2.True3.Run-time error4.None of the above​

What is the output of the following code

Asked by admin @ in Computer Science viewed by 355 persons

What is the output of the following code? dict 1={}dict 1["x"]=[5]print (dict 1["x"][5])a) 5b) [5]c) 0d) The code generates an error​

What would be the output of the following code

Asked by admin @ in Computer Science viewed by 353 persons

What would be the output of the following code.explain..a=2+5/8

What is the output of the following code snippet

Asked by admin @ in Computer Science viewed by 424 persons

6. What is the output of the following code snippet? a=5 for i in range(10) a=a+1  a. 15  b. 5  c. 0  d. Error   7. What happens when the following …

What will be the output of the following code

Asked by admin @ in Computer Science viewed by 290 persons

What will be the output of the following code? print( (3 < 1) and (4/0 > 1))1.False2.True3.Run-time error4.None of the above​

Write the html code to generate the following output

Asked by admin @ in Computer Science viewed by 372 persons

Write html code to generate the following output​

What does the following piece of code do

Asked by admin @ in Computer Science viewed by 325 persons

What does the following piece of code do? 1 public Object function()2 {3 if(isEmpty)4 return -999;5 else6 {7Object high;8high = q[front); …

Reusability of code in c++ is achieved through

Asked by admin @ in Computer Science viewed by 265 persons

Reusability of code in c++ is achieved through​

Which of the following are tokens in c

Asked by admin @ in Computer Science viewed by 331 persons

Identify which of the following are the C token(s) a) Keyword b) Constants c) operators d) All Of these

Which of the following html code is valid

Asked by admin @ in Computer Science viewed by 379 persons

Which of the following HTML code is valid OR OR OR

Which of the following is an output device

Asked by admin @ in Computer Science viewed by 407 persons

Which of the following is an output device​

What is the output of the following 4 5

Asked by admin @ in Computer Science viewed by 302 persons

What is the output of the following : 4//5 What is the output of the following : 4//5 ? 1.12.0.83.04.8​

Which of the following occupies more memory in c

Asked by admin @ in Computer Science viewed by 8131 persons

Which data type occupies most amount of memory in c?

What will be the output of the following pseudocode

Asked by admin @ in Computer Science viewed by 317 persons

What would be the output of the following pseudocode? 1) Integer i, j, k 2) Set k = 6 3) For (each i from 1 to 1) 4) For (each …

What would be the output of the following program

Asked by admin @ in Computer Science viewed by 335 persons

What would be the output of the following program? main(){int i=4;switch(i).{default:printf("\n A mouse is an elephant built by the Japanese");case 1:printf(" Breeding …

Most viewed questions in Computer Science


A programmer mistakenly writes gor instead of for

Asked by admin @ in Computer Science viewed by 19017 persons


Domestic data entry operator ncert book class 9 solutions

Asked by admin @ in Computer Science viewed by 15800 persons


Information technology code 402 class 9 solutions chapter 1

Asked by admin @ in Computer Science viewed by 10967 persons



Ncert solutions for class 8 computer chapter 1 computer system

Asked by admin @ in Computer Science viewed by 10399 persons


A scrum team works on a 4 weeks sprint

Asked by admin @ in Computer Science viewed by 8719 persons


Which of the following occupies more memory in c

Asked by admin @ in Computer Science viewed by 8131 persons



A database of motor vehicles has the base entity

Asked by admin @ in Computer Science viewed by 7839 persons


The network architecture can be termed as a mcq

Asked by admin @ in Computer Science viewed by 6482 persons


Cat5 and cat6 cabling refer to which reference model layer

Asked by admin @ in Computer Science viewed by 5786 persons



Class 7 computer chapter 3 questions and answers

Asked by admin @ in Computer Science viewed by 5685 persons


Choose the correct options about usability and user experience

Asked by admin @ in Computer Science viewed by 5472 persons


Which advocates daily team meetings for coordination and integration

Asked by admin @ in Computer Science viewed by 4978 persons



Which three security features match the database security level

Asked by admin @ in Computer Science viewed by 4969 persons


Which of the dbms package is not available

Asked by admin @ in Computer Science viewed by 4680 persons


________ aid a business grow and attain its objectives

Asked by admin @ in Computer Science viewed by 4485 persons