JobseekersIndia

Welcome to JobSeekersIndia.

JobSeekersIndia Provides Latest Job updates in India , Freshers Job Openings, WalkIn Updates, Off Campus Interviews, Government Jobs, IT/Software Jobs, Bank Jobs, BPO CallCenter Jobs Internships Jobs in Various industries, Interview question Papers, Interview Tips, Company Addresses, Placement papers, Internship projects, Details about companies, Resume Writing Tips, Fake companies List and More..

Search Your Dream Job Here

Showing posts with label Technical interview Questions. Show all posts
Showing posts with label Technical interview Questions. Show all posts

Operating System Interview Questions And Answers As pdf File Free download

operating system interview questions Operating Systems Interview Questions and Answers Operating Systems interview questions and answers for freshers .Interview questions and answers, interview questions for operating system, Operating System, operating system interview, operating system interview questions, operating system interview questions pdf , operating system interview questions and answers for freshers, operating system interview questions and answers pdf, operating system interview questions answers, operating system questions,operating system tutorial



This section includes The following Operating system interview Questions…


1.      Explain the concept of Reentrancy.
2.      Explain Belady's Anomaly.
3.      What is a binary semaphore? What is its use?
4.      What is thrashing?
5.      List the Coffman's conditions that lead to a deadlock.
6.      What are short-, long- and medium-term scheduling?
7.      What are turnaround time and response time?
8.      What are the typical elements of a process image?
9.      What is the Translation Lookaside Buffer (TLB)?
10. What is the resident set and working set of a process?
11. When is a system in safe state?
12. What is cycle stealing?
13. What is meant by arm-stickiness?
14. What are the stipulations of C2 level security?
15. What is busy waiting?
16. Explain the popular multiprocessor thread-scheduling strategies.
17. When does the condition 'rendezvous' arise?
18. What is a trap and trapdoor?
19. What are local and global page replacements?
20. Define latency, transfer and seek time with respect to disk I/O.
21. Describe the Buddy system of memory allocation.
22. What is time-stamping?
23. How are the wait/signal operations for monitor different from those for semaphores?
24. In the context of memory management, what are placement and replacement algorithms?
25. In loading programs into memory, what is the difference between load-time dynamic linking and run-time dynamic linking?
26. What are demand- and pre-paging?
27. Paging a memory management function, while multiprogramming a processor management function, are the two interdependent?
28. What is page cannibalizing?
29. What has triggered the need for multitasking in PCs?
30. What are the four layers that Windows NT have in order to achieve independence?
31. What is SMP?
32. What are the key object oriented concepts used by Windows NT?
33. Is Windows NT a full blown object oriented operating system? Give reasons.
34. What is a drawback of MVT?
35. What is process spawning?
36. How many jobs can be run concurrently on MVT?
37. List out some reasons for process termination.
38. What are the reasons for process suspension?
39. What is process migration?
40. What is mutant?
41. What is an idle thread?
42. What is FtDisk?
43. What are the possible threads a thread can have?
44. What are rings in Windows NT?
45. What is Executive in Windows NT?
46. What are the sub-components of I/O manager in Windows NT?
47. What are DDks? Name an operating system that includes this feature.
48. What level of security does Windows NT meets?

Click Here To Download OS Interview Questions And Answers As PDF



Important: 


Downloading instructions: 

1.click the link
2. it will redirect you to google documents.
3. Click file-> Download As

and select the format to download..



All The Best... 

Give Your Suggestions as comments..



 Embedded Format..




Wipro Placement Paper-Wipro sample Interview Question paper

Wipro Placement Paper, Wipro, Common interview questions, Wipro Placement Paper, Interview Question Paper, Interview Questions, Technical interview Questions, Aptitude Questions, Verbal Questions, Non Verbal Questions, Company interview Questions,Wipro sample paper


Aptitude test :
Questions = 50; time limit = 50 minutes. No negative marking. Offline (paper & pen) test. There was individual cut off for all the sections

Section 1: English, 15 questions


Direction 1-5: In each of the following questions, find out which part of the sentence has an error. If there is no mistake the answer is 'no error'
1. Twice twelve / makes / twenty four / No error
A B C D
Ans: B
2. The flight purser took control / of the plane after / the pilot had had / a heart attack / No error
A B C D E
Ans: C
3. My friend did not see me / for many years / when I met him last week / No error
A B C D
Ans: A
4. We grieve our loss and cry helplessly / while we should be fighting for our rights / and die a noble death / No error
A B C D
Ans: B
5. Work hard / lest you will / fail / No error
A B C D
Ans: D
Directions 6-10: The following questions consist of two words each that have a certain relationship to each other, followed by four lettered pairs of words. Select the lettered pair that has the same relationship as the original pair of words.
6. Kangaroo: Australia
A) Whale: River B) Elephant: Russia C) Penguin: Antarctica D) India: Peacock
Ans: C
7. Coronation: Reign
A) Vaccination: Immunity B) Sculptor: Statue C) Degree : Graduate D) Summer: Rain
Ans: D
8. Grain: Salt
A) Chip: Glass B) Blades: Grass C) Shred: Wood D) Shard: Pottery
Ans: A
9. Scythe; Reaping
A) Light: Shining B) Shears: Cutting C) Saws: Gluing D) Screws: Turning
Ans: B
10. Dislike: Repulsion
A) Dream: Sleep B) Steal: Crime C) Reputation: Behavior D) Intelligence: Wit
Ans: D
Directions 11-12: In each of the following questions, a sentence has been given in Active (or passive) voice. Out of the four alternatives suggested select the one which best express the same sentence in Passive (or Active) Voice.
11. His pocket has been picked.
A) They have his pocket picked
B) Picking has been done to his pocket
C) Picked has been his pocket
D) Someone has picked his pocket.
Ans: D
12. Someone gave her a bull dog.
A) She was given a bull dog.
B) a bull dog was given to her
C) She has been given a bull dog
D) She is being given a bull dog by someone
Ans: B
Directions 13-15: Pick out the most effective word from the given words to fill in the blank to make the sentence meaningfully complete
13. He succeeded in getting possession..............his land after a long court case
A) For B) to C) of D) with E) against
Ans: C
14. Now a day Rajani is .............busy to take care of her health.
A) Very B) too C) so D) extremely
Ans: B
15. Had the police not reached there in time the bandits him
A) Did have killed B) will have killed C) would kill D) would have killed
Ans: D






Section 2: Aptitude 15 questions


The questions 1-5 are based on the following data six knights - P, Q, R, S, T and U - assemble for a long journey in two traveling parties. For security, each traveling party consists of at least two knights. The two parties travel by separate routes, northern and southern. After one month, the routes of the northern and southern groups converge for a brief time and at that point the knights can, if they wish, rearrange their traveling.
Parties before continuing, again in two parties along separate northern and southern routes. Throughout the entire trip, the composition of traveling parties must be in accord with the following conditions P and R are deadly enemies and, although they may meet briefly, can never travel together.
P must travel in the same party with S
Q can't travel by the southern route
U can't change routes
1. If one of the two parties of knights consists of P and U and two other knights and travels by the southern route, the other members of this party besides P and U must be
a) Q and S
b) Q and T
c) R and S
d) R and T
e) S and T
Ans: e
2) If each of the two parties of knights consists of exactly three members, which of the following is not a possible traveling party and route?
a) P,S,U by the northern route
b) P,S,T by the northern route
c) P,S,T by the southern route
d) P,S,U by the southern route
e) Q,R,T by the southern route
Ans: a
3) If one of the two parties of knights consists of U and two other knights and travels by the northern route, the other members of this party >besides U must be
a) P and S
b) P and T
c) Q and R
d) Q and T
e) R and T
Ans: c
4) If each of the two parties of knights consists of exactly three members of different parties, and R travels by the Northern route, then T must travel by the
a) southern route with P and S
b) southern route with Q and R
c) southern route with R and U
d) northern route with Q and R
e) northern route with R and U
Ans: a
5) If, when the two parties of knights encounter one another after a month, exactly one knight changes from one traveling party to the other traveling party, that knight must be
a) P b) Q c) R d) S e) T
Ans: e
6. X varies inversely as square of y. Given that y = 2 for x = 1. The value of x for y = 6 will be equal to
A) 3 B) 9 C) 1/3 D) 1/9
Ans: D
7. If 10% of x = 20% of y, then x: y is equal to
A) 1: 2 B) 2: 1 C) 5: 1 D) 10: 1
Ans: B
8. A starts business with Rs.3500 and after 5 months, B joins with A as his partner. After a year, the profit is divided in the ratio 2 : 3. What is B's contribution in the Capital?
A) Rs. 7500 B) Rs. 8000 C) Rs. 8500 D) Rs. 9000
Ans: D
9. Ronald and Elan are working on an assignment. Ronald takes 6 hours to type 32 pages on a computer, while Elan takes 5 hours to type 40 pages. How much time will they take, working together on two different computers to type an assignment of 110 pages?
A) 7 hours 30 minutes B) 8 hours C) 8 hours 15 minutes D) 8 hours 25 minutes
Ans: C
10. A and B can do a piece of work in 72 days; B and C can do it in 120 days; A dn C can do it in 4 days. Who among these will take the least time if put to do it alone?
A) 80 days B) 100 days C) 120 days D) 150 days
Ans: C
11. A cistern can be filled by a tap in 4 hours while it can be emptied by another tap in 9 hours. If both taps are opened simultaneously, then after how much time will the cistern get filled?
A) 4.5 hours B) 5 hours C) 6.5 hours D) 7.2 hours
Ans: D
12. Pipe a can fill a tank in 5 hours, pipe B in 10 hours and pipe C in 30 hours. If all the pipes are open, in how many hours will the tank completely?
A) 6 min. to empty B) 6 min to fill C) 9 min. to empty D) 9 min. to fill
Ans: C
13. A thief steals a car at 2.30 p.m and drives it at 60 kmph. The theft is discovered at 3 p.m and the owner sets off in another car at 75 kmph. When will be overtake the thief.
A) 4.30 p.m B) 4.45 p.m C) 5 p.m D) 5.15 p.m
Ans: E
14. Two trains starting at the same time from two stations 200 km apart, and going in opposite directions cross each other at a distance of 110 km from one of the stations. What is the ratio of their speeds?
A) 9: 20 B) 11: 9 C) 11: 20 D) None of these
Ans: B
15. Two trains each 100 m long, moving in opposite directions, cross each other in 8 seconds. If one is moving twice as fast the other, then the speed of the faster train is
A) 30 km /hr B) 45 km / hr C) 60 km/hr D) 75 km/hr
Ans: C






Section 3: Technical, 20 questions






Predict the output or error(s) for the following:
1. main()
{
char string[]="Hello World";
display (string);
}
void display (char *string)
{
printf("%s",string);
}
Ans: Compiler Error: Type mismatch in redeclaration of function display
2. What are the values printed by the following program?
#define dprint(expr) printf(#expr "=%d\n",expr)
main()
{
int x=7;
int y=3;
dprintf(x/y);
}
a) #2 = 2 b) expr=2 c) x/y=2 d) none
Ans: c
3) Parameterization generally involves
a. Data table
b. Random number
c. Environment
d. Both A & B
e. Both A, B & C
Ans: e
4) The file which is used for recovering from the run time errors known as
A. QRS B. TSR C. PNG D. DAT
Ans: A
5) Among the following recording modes, which method uses both the objects and mouse coordinates
a. Normal b. Low level c. Analog d. All of the above
Ans: b
6) Where do you set the action iterations for a specified action?
a. Action Settings
b. Action Properties
c. Action Run Properties
d. Action Call Properties
Ans: d
6) Where do you mark an action as reusable?
a. Action Settings
b. Action Properties
c. Action Run Properties
d. Action Call Properties
Ans: b
7) After running a test that contains both input and output parameters, where can the results of an output parameter be found?
a. Local Data Sheet
b. Global Data Sheet
c. Run-time Data Table
d. Design-time Data Table
Ans: c
8) If you have a Virtual Object Collection stored on your machine, and you don’t want to use it what you must do?
a. Disable Virtual Objects in Test Settings
b. Remove the Collection from your machine
c. Disable Virtual Objects in General Options
d. Remove the Collections from the Resources list
Ans: c
9. For a 25MHz processor, what is the time taken by the instruction which needs 3 clock cycles,
(a) 120 nano secs (b) 120 micro secs
(c) 75 nano secs (d) 75 micro secs
Ans: a
10. For 1 MB memory, the number of address lines required,
(a) 11 (b) 16 (c) 20(d) 24
Ans. (c)
11. Semaphore is used for
(a) synchronization (b) dead-lock avoidance (c) box (d) none
Ans. (a)
12. OLE is used in
a) Inter connection in UNIX
b) Interconnection in WINDOWS
c) Interconnection in WINDOWS NT
d)None
Ans: c
13. Preprocessor does not do which one of the following
(a) macro (b) conditional compliclation
(c) in type checking (d) including load file
Ans. (c)
14. Piggy backing is a technique for
a) Flow control b) Sequence c) Acknowledgement d) retransmission
Ans. (c)
15. In signed magnitude notation what is the minimum value that can be represented with 8 bits
(a) -128 (b) -255 (c) -127 (d) 0
Ans: a
17. When an array is passed as parameter to a function, which of the following statement is correct
a) The function can change values in the original array
b) In C parameters are passed by value. The function cannot change the original value in the array
c) It results in compilation error when the function tries to access the elements in the array
d) Results in a run time error when the function tries to access the elements in the array
Ans: a
18. The type of the controlling statement of a switch statement cannot be of the type
a) int b) char c) short d) float e) none
Ans: d
19. What is the value of the statement (3^6) + (a^a)?
a) 3 b) 5 c) 6 d) a+18 e) None
Ans: b
20. Consider the following program:
# include
class x {
public:
int a;
x();
};
x::x() { a=10; cout<
class b:public x {
public:
b();
};
b::b() { a=20; cout<
main ()
{ b temp;
}
 What will be the output of this program?
a) 10 b) 20 c) 2010 d) 1020
Ans: b

C Programming Interview Questions Part Seven

C Programming Interview Questions with answers, interview questions and answers, c programming interview question part seven.learn c programming online, c programs, online c questions
 

<< Prev      1      2      3      4      5      6      7     


Part 7

100)

void main()
{
int i;
char a[]="\0";
if(printf("%s\n",a))
printf("Ok here \n");
else
printf("Forget it\n");
}

Answer:

Ok here

Explanation:

Printf will return how many characters does it print. Hence
printing a null character returns 1 which makes the if
statement true, thus "Ok here" is printed.




101)
 void main()
{
void *v;
 Page 32 6/26/2004
32
int integer=2;
int *i=&integer;
v=i;
printf("%d",(int*)*v);
}

Answer:

Compiler Error. We cannot apply indirection on type void*.

Explanation:

Void pointer is a generic pointer type. No pointer arithmetic can
be done on it. Void pointers are normally used for,
1. Passing generic pointers to functions and returning such
pointers.

2. As a intermediate pointer type.
3. Used when the exact pointer type will be known at a later
point of time.



102)
 void main()
{
int i=i++,j=j++,k=k++;
printf(“%d%d%d”,i,j,k);
}

Answer:

Garbage values.

Explanation:

An identifier is available to use in program code from the point of
its declaration.
So expressions such as i = i++ are valid statements. The i, j and k
are automatic variables and so they contain some garbage value.
Garbage in is garbage out (GIGO).




103)
 void main()
{
static int i=i++, j=j++, k=k++;
printf(“i = %d j = %d k = %d”, i, j, k);
}

Answer:

i = 1 j = 1 k = 1

Explanation:

Since static variables are initialized to zero by default.

104) void main()
{
while(1){
if(printf("%d",printf("%d")))
break;
else
continue;
}
}

Answer:

Garbage values

Explanation:

The inner printf executes first to print some garbage value. The
printf returns no of characters printed and this value also cannot be
predicted. Still the outer printf prints something and so returns a
non-zero value. So it encounters the break statement and comes
out of the while statement.



104) main()
{
unsigned int i=10;
while(i-->=0)
printf("%u ",i);
}

Answer:

10 9 8 7 6 5 4 3 2 1 0 65535 65534…..

Explanation:

Since i is an unsigned integer it can never become negative. So the
expression i-- >=0 will always be true, leading to an infinite loop.




105) #include<conio.h>
main()
{
int x,y=2,z,a;
if(x=y%2) z=2;
a=2;
printf("%d %d ",z,x);
}

Answer:

Garbage-value 0

Explanation:

The value of y%2 is 0. This value is assigned to x. The condition
reduces to if (x) or in other words if(0) and so z goes uninitialized.
Thumb Rule: Check all control paths to write bug free code.



106) main()
{
int a[10];
printf("%d",*a+1-*a+3);
}

Answer:

4

Explanation:

*a and -*a cancels out. The result is as simple as 1 + 3 = 4 !



107) #define prod(a,b) a*b
main()
{
int x=3,y=4;
printf("%d",prod(x+2,y-1));
}

Answer:

10


Explanation:

The macro expands and evaluates to as:
x+2*y-1 => x+(2*y)-1 => 10



108) main()
{
unsigned int i=65000;
while(i++!=0);
printf("%d",i);
}

Answer:

1

Explanation:

Note the semicolon after the while statement. When the value of i
becomes 0 it comes out of while loop. Due to post-increment on i
the value of i while printing is 1.




109) main()
{
int i=0;
while(+(+i--)!=0)
i-=i++;
printf("%d",i);
}

Answer:

-1

Explanation:

Unary + is the only dummy operator in C. So it has no effect on
the expression and now the while loop is, while(i--!=0) which is
false and so breaks out of while loop. The value –1 is printed due
to the post-decrement operator.




113) main()
{
float f=5,g=10;
enum{i=10,j=20,k=50};
printf("%d\n",++k);
printf("%f\n",f<<2);
printf("%lf\n",f%g);
printf("%lf\n",fmod(f,g));
}

Answer:

Line no 5: Error: Lvalue required
Line no 6: Cannot apply leftshift to float
Line no 7: Cannot apply mod to float

Explanation:

Enumeration constants cannot be modified, so you cannot apply
++.
Bit-wise operators and % operators cannot be applied on float
values.
fmod() is to find the modulus values for floats as % operator is for
ints.




110) main()
{
int i=10;
void pascal f(int,int,int);
f(i++,i++,i++);
printf(" %d",i);
}
void pascal f(integer :i,integer:j,integer :k)
{
write(i,j,k);
}

Answer:

Compiler error: unknown type integer
Compiler error: undeclared function write

Explanation:

Pascal keyword doesn’t mean that pascal code can be used. It
means that the function follows Pascal argument passing mechanism in
calling the functions.




111) void pascal f(int i,int j,int k)
{
printf(“%d %d %d”,i, j, k);
}
void cdecl f(int i,int j,int k)
{
printf(“%d %d %d”,i, j, k);
}
main()
{
int i=10;
f(i++,i++,i++);
printf(" %d\n",i);
i=10;
f(i++,i++,i++);
printf(" %d",i);
}

Answer:

10 11 12 13
12 11 10 13

Explanation:

Pascal argument passing mechanism forces the arguments to be
called from left to right. cdecl is the normal C argument passing
mechanism where the arguments are passed from right to left.




112). What is the output of the program given below
main()
{
signed char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}

Answer:

-128

Explanation:

Notice the semicolon at the end of the for loop. THe initial
value of the i is set to 0. The inner loop executes to
increment the value from 0 to 127 (the positive range of
char) and then it rotates to the negative value of -128. The
condition in the for loop fails and so comes out of the for
loop. It prints the current value of i that is -128.




113) main()
{
unsigned char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}

Answer

infinite loop

Explanation

The difference between the previous question and this one is that
the char is declared to be unsigned. So the i++ can never yield negative
value and i>=0 never becomes false so that it can come out of the for
loop.




114) main()
{
char i=0;
for(;i>=0;i++) ;
printf("%d\n",i);
}

Answer:

Behavior is implementation dependent.

Explanation:

The detail if the char is signed/unsigned by default is
implementation dependent. If the implementation treats the char
to be signed by default the program will print –128 and terminate.
On the other hand if it considers char to be unsigned by default, it
goes to infinite loop.

Rule:

You can write programs that have implementation
dependent behavior. But dont write programs that depend on such
behavior.




115) Is the following statement a declaration/definition. Find what does it
mean?
int (*x)[10];

Answer

Definition.

x is a pointer to array of(size 10) integers.
Apply clock-wise rule to find the meaning of this definition.




116). What is the output for the program given below
typedef enum errorType{warning, error, exception,}error;
main()
{
error g1;
g1=1;
printf("%d",g1);
}

Answer

Compiler error: Multiple declaration for error

Explanation

The name error is used in the two meanings. One means
that it is a enumerator constant with value 1. The another use is
that it is a type name (due to typedef) for enum errorType. Given a
situation the compiler cannot distinguish the meaning of error to
know in what sense the error is used:
error g1;
g1=error;
// which error it refers in each case?
When the compiler can distinguish between usages then it
will not issue error (in pure technical terms, names can only be
overloaded in different namespaces).

Note: the extra comma in the declaration,
enum errorType{warning, error, exception,}
is not an error. An extra comma is valid and is provided just for
programmer’s convenience.




117) typedef struct error{int warning, error,
exception;}error;
main()
{
error g1;
g1.error =1;
printf("%d",g1.error);
}

Answer

1

Explanation

The three usages of name errors can be distinguishable by the
compiler at any instance, so valid (they are in different namespaces).
Typedef struct error{int warning, error, exception;}error;
This error can be used only by preceding the error by struct kayword as
in:
struct error someError;
typedef struct error{int warning, error, exception;}error;
This can be used only after . (dot) or -> (arrow) operator preceded by the
variable name as in :
g1.error =1;
printf("%d",g1.error);
typedef struct error{int warning, error, exception;}error;
This can be used to define variables without using the preceding struct
keyword as in:
error g1;
Since the compiler can perfectly distinguish between these three usages, it
is perfectly legal and valid.

Note

This code is given here to just explain the concept behind. In real
programming don’t use such overloading of names. It reduces the
readability of the code. Possible doesn’t mean that we should use it!





118) #ifdef something
int some=0;
#endif
main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
}

Answer:

Compiler error : undefined symbol some

Explanation:

This is a very simple example for conditional compilation.
The name something is not already known to the compiler
making the declaration
int some = 0;
effectively removed from the source code.




119) #if something == 0
int some=0;
#endif
main()
{
int thing = 0;
printf("%d %d\n", some ,thing);
}

Answer

0 0

Explanation

This code is to show that preprocessor expressions are not
the same as the ordinary expressions. If a name is not
known the preprocessor treats it to be equal to zero.





120). What is the output for the following program
main()
{
int arr2D[3][3];
printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0]))
);
}

Answer

1

Explanation

This is due to the close relation between the arrays and
pointers. N dimensional arrays are made up of (N-1)
dimensional arrays.
arr2D is made up of a 3 single arrays that contains 3
integers each .
The name arr2D refers to the beginning of all the 3 arrays.
*arr2D refers to the start of the first 1D array (of 3
integers) that is the same address as arr2D. So the
expression (arr2D == *arr2D) is true (1).
Similarly, *arr2D is nothing but *(arr2D + 0), adding a zero
doesn’t change the value/meaning. Again arr2D[0] is the
another way of telling *(arr2D + 0). So the expression
(*(arr2D + 0) == arr2D[0]) is true (1).
Since both parts of the expression evaluates to true the
result is true(1) and the same is printed.





121) void main()
{
if(~0 == (unsigned int)-1)
printf(“You can Answer this if you know how values are represented
in memory”);
}

Answer

You can answer this if you know how values are represented
in memory

Explanation

~ (tilde operator or bit-wise negation operator) operates on
0 to produce all ones to fill the space for an integer. –1 is
represented in unsigned value as all 1’s and so both are
equal.




122) int swap(int *a,int *b)
{
*a=*a+*b;*b=*a-*b;*a=*a-*b;
}
main()
{
int x=10,y=20;
swap(&x,&y);
arr2D
arr2D[1]
arr2D[2]
arr2D[3]
printf("x= %d y = %d\n",x,y);
}

Answer

x = 20 y = 10

Explanation

This is one way of swapping two values. Simple checking will help
understand this.




123) main()
{
char *p = “ayqm”;
printf(“%c”,++*(p++));
}

Answer:

b





124) main()
{
int i=5;
printf("%d",++i++);
}

Answer:

Compiler error: Lvalue required in function main

Explanation:

++i yields an rvalue. For postfix ++ to operate an lvalue is
required.




125) main()
{
char *p = “ayqm”;
char c;
c = ++*p++;
printf(“%c”,c);
}

Answer:

b

Explanation:


There is no difference between the expression ++*(p++)
and ++*p++. Parenthesis just works as a visual clue for the
reader to see which expression is first evaluated.





126)
int aaa() {printf(“Hi”);}
int bbb(){printf(“hello”);}
iny ccc(){printf(“bye”);}
main()
{
int ( * ptr[3]) ();
ptr[0] = aaa;
ptr[1] = bbb;
ptr[2] =ccc;
ptr[2]();
}

Answer:

bye

Explanation:

int (* ptr[3])() says that ptr is an array of pointers to functions
that takes no arguments and returns the type int. By the
assignment ptr[0] = aaa; it means that the first function pointer in
the array is initialized with the address of the function aaa.
Similarly, the other two array elements also get initialized with the
addresses of the functions bbb and ccc. Since ptr[2] contains the
address of the function ccc, the call to the function ptr[2]() is same
as calling ccc(). So it results in printing "bye".






127)
main()
{
int i=5;
printf(“%d”,i=++i ==6);
}

Answer:

1

Explanation:

The expression can be treated as i = (++i==6), because == is of
higher precedence than = operator. In the inner expression, ++i is
equal to 6 yielding true(1). Hence the result.





128) main()
{
char p[ ]="%d\n";
p[1] = 'c';
printf(p,65);
}

Answer:

A

Explanation:

Due to the assignment p[1] = ‘c’ the string becomes, “%c\n”.
Since this string becomes the format string for printf and ASCII
value of 65 is ‘A’, the same gets printed.





129) void ( * abc( int, void ( *def) () ) ) ();

Answer::

abc is a ptr to a function which takes 2 parameters .(a). an
integer variable.(b). a ptrto a funtion which returns void. the
return type of the function is void.

Explanation:

Apply the clock-wise rule to find the result.




130) main()
{
while (strcmp(“some”,”some\0”))
printf(“Strings are not equal\n”);
}

Answer:

No output

Explanation:

Ending the string constant with \0 explicitly makes no difference.
So “some” and “some\0” are equivalent. So, strcmp returns 0
(false) hence breaking out of the while loop.






<< Prev      PART 1      PART 2      PART 3      PART 4      PART 5      PART 6      PART 7     






Popular Posts in this Weak