Give the output of the following program
main()
{int ret;
ret=fork();ret=fork();ret=fork();ret=fork();
if(!ret)
printf("sun");
else
printf("solaris");

Answers were Sorted based on User's Feedback



Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fo..

Answer / rojoco

Imagining that the correct headers were included and the
closing bracket for the main function is added, it'll print
sun 8 times and solaris 8 times. You won't know the order
that they're printed in, it depends on the kernel scheduler
as to which process is run first.

Is This Answer Correct ?    11 Yes 1 No

Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fo..

Answer / imran

I dont't think this will compile as its missing a closing
brace.

Is This Answer Correct ?    13 Yes 5 No

Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fo..

Answer / anupam mittal

The ans depend on the value returned by the fork function
there is no fork function defined so we can not predict he
ans

Is This Answer Correct ?    3 Yes 0 No

Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fo..

Answer / pdp

It depends on the return value of fork(). If it is other
than 0 (zero), then the output is solaris else sun.

Is This Answer Correct ?    6 Yes 5 No

Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fo..

Answer / saif

yes

Is This Answer Correct ?    1 Yes 1 No

Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fo..

Answer / prasanna

It will print solaris first and then sun... A sequence of
solarissun if there is a closing brace at the end..!!

Is This Answer Correct ?    1 Yes 4 No

Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fo..

Answer / saurabh singh

first of all it will not execute bec of 2 reasons:
1.it doesn't have a closing braces.
2.fork() function is not defined anywhere.so it will show
an error.

Is This Answer Correct ?    2 Yes 5 No

Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fo..

Answer / tajul bashar

sunsolarissunsolarissunsolarissunsol

Is This Answer Correct ?    3 Yes 13 No

Post New Answer

More STL Interview Questions

write a piece of c++ code which allocate memory to the 50 object of type CObj

2 Answers  


what are you now programming Languages C+

1 Answers   HCL,


draw a flowchart that accepts two numbers and checks if the first is divisible by the second.

0 Answers   Appin, NIIT,


Give the output of the following program main() {int ret; ret=fork();ret=fork();ret=fork();ret=fork(); if(!ret) printf("sun"); else printf("solaris");

8 Answers   Sun Microsystems,


what is compiler?

4 Answers   NASA,






HOW TO GET "H1B" -VISA 4 USA FOR MY SON?HE HAD COMPLETED "MS"(IT)FROM AUSTALIA 2007.I AM WORKING IN U.S.A.

0 Answers  


How do I convert a stl file?

0 Answers  


Here are the questions and paper pattern from a Birlasoft previous placement paper held at Kolkata, West Bengal. There are two sections 1. Technical questions - 20 2. Aptitude questions - 25 Birlasoft Technical Multiple Choice Questions: Largest integer can be written from 8 bits is a. 256 b. 255 c. 8 d. 10 Change a hexadecimal no to octal How many address lines needed to pass 1MB of data. What is the function of the modulus operator in most language. a) Sets a system environmental value to either base 10 ,base 8 or base 16 b) Returns the remainder after dividing one number by another c) Returns the first argument raised to the second argument power d) Prints out the actual code written to standard output rather than executing the code class professor{} class teacher: public virtual professor{}; class researcher: public virtual professor {} class myprofessor :public teacher,public researcher {}; Referring to the sample code above ,if an object of class myprofessor were created ,how many instances of professor will it contain? a) 0 b) 1 c) 2 d) 3 Modern RDBMS s perfom the following the following functionc except _______. a) Force column values in one table to match any of the values in a column of another table b) Automatically replicate data on another server c) Automatically create new indexes based on query history d) Prevent unauthorized users from accessing data at the firls level RDBMS triggers are typically bound to a _________and one or more a) Table,SQL statement types b) SQL statement type,user c) Column,rows d) User, table What relationship is resolved by an intersecting or associative entity ? a) Recursive b) Mandatory one to one c) Many to Many d) One to One Make a copy of file upper in the directory two levels up . a) jump -2 upper b) cp upper ../..(answer) c) cp upper -2/ d) None of the above i = 0; j = 0; for(j=1;j<10;j++) i=i+1; In the (generic) code segment above what will be the value of the variable i at completion ? a) 0 b) 1 c) 3 d) 9 e) 10 Which of the following statements is true when a derivation inherits both a virtual and non-virtual instance of a base class ? a) Each derived class object has base objects only from the non virtual instance b) Each base class object has derived objects only from the non-virtual instance c) Each derived class object has base objects only from the virtual instance d) Each derived class object has a base object from the virtual instance and a base object from non-virtual instance. class Word { public: Word(const char*,int = 0); }; Referring to the sample code above what is the minimum number of arguments required to call the constructor ? a) 0 b) 1 c) 2 d) 3 What is the function of the modulus operator in most languages ? a) Sets a system environmental value to either base 10 ,base 8 or base 16 b) Returns the remainder after dividing one number by another c) Returns the first argument raised to the second argument power d) Prints out the actual code written to standard output rather than executing the code lass professor{} class teacher: public virtual professor{}; class researcher: public virtual professor {} class myprofessor :public teacher,public researcher {}; Referring to the sample code above ,if an object of class ? myprofessor? were created ,how many instances of professor will it contain? a) 0 b) 1 c) 2 d) 3 Modern RDBMS?s perfom the following the following functionc except a) Force column values in one table to match any of the values in a column of another table b) Automatically replicate data on another server c) Automatically create new indexes based on query history d) Prevent unauthorized users from accessing data at the firls level Which is not the characteristics of a view ? a) Consumes Disk space for data b) Multiple tables c) Multiple rows d) Updateable Technical Questions for computer science engineering students placement paper - cse branch tech / technical interview and written test paper questions from sql, rdbms, queries, c language, programming, etc. The questions are multiple choice / objective type. RDBMS triggers are typically bound to a ________and one or more ________ a) Table,SQL statement types b) SQL statement type,user c) Column,rows d) User, tables What relationship is resolved by an ?intersecting? or ? associative? entity ? a) Recursive b) Mandatory one to one c) Many to Many d) One to One Make a copy of file ?upper? in the directory two levels up . a) jump -2 upper b) cp upper ../.. c) cp upper -2/ d) None of the above Birlasoft Aptitude Section Questions: Question like A is engg. B is doctor C is artist etc then few condition related to them you have give answer to 4 or 5 qs on these conditions . same as above with different data and conditions. 3 qs onfinding error in english sentences If father is three times as old as son . 5 years ago he was 4 times age of his son what is son age. Same as above but now daughter and mother joined in and age in question is that of daughter. A figure is given find no of traingles in this figure Same as above but figure is diffrent and find no of squares and triangles. See other latest free online Birlasoft India placement exam test papers here with technical hr interview candidate real experiences from all over india - submitted by college freshers and company campus recruitment drives.

0 Answers   BirlaSoft,


what is c++

2 Answers  


What is the disadvantage of templates ?

2 Answers   NSN, Symphony,


Q1. A. What is unary operator? List out the different operators involved in the unary operator. B. What is an adjust field format flag? Q2. A. Distinguish between a # include and #define. B. Can a list of string be stored within a two dimensional array? Q3. A.Explain how a pointer to function can be declared in C++? B.List the merits and demerits of declaring a nested class in C++? Q4. A. What are the syntactic rules to be avoid ambiguity in multiple inheritence? B. Explain the operation of overloading of an assignment operator. Q5. A. Explain how the virtual base class is different from the conventional base classes of the opps. B. Explain how an exception handler is defined and invoked in a Program. Q6. A. What is a binary file? List the merits and demerits of the binary file usagein C++. B. Write short notes on Text Manipulation Routines. C. Write bites in Turbo c++ Header (“Include”) Files.

0 Answers   GE, Infosys, Microsoft, NIM,


What is stl stand for?

0 Answers  


Categories