Monday, May 28, 2007

Urgent

Now 'Campus Online' has been shifted to http://campus4you.blogspot.com/

Friday, May 25, 2007

Campus_14

Earn 1860 Rs/Month by reading SMS

=========================================================
1. A trader has 100 Kg of wheat, part of which he sells at 5% profit and the rest at 20% profit. He gains 15% on the whole. Find how much is sold at 5% profit?
(A) 60
(B)50
(C)66.66
(D) 33.3

2. In 1978, a kg of paper was sold at Rs25/-. If the paper rate increases at 1.5% more than the inflation rate which is 6.5% a year, then what wil be the cost of a kg of paper after 2 years?

3. A driver drives at a speed of 72kmph in a highway. Another driver drives at the speed of 25 m/sec . find the difference in their speeds in m/sec. ?

4. In a mixture R is 2 parts and S is 1 part. In order to make
S to 25% of the mixture how r is needed ?
=========================================================

Imprtant: Send answer of Campus_14 (Aptitude) top 10 right answer sender's name will be published on main page of sandeeoinfo.com
so send your answer quickly.

Process to send answer- Send your answer along with your name and your college name to sandeepinfo@yahoo.co.in

Join http://groups.yahoo.com/group/campus_online/ for more updated information


Earn 1860 Rs/Month by reading SMS

Wednesday, May 23, 2007

Campus_13 (C Question)

Earn 1860 Rs/Month by reading SMS

Winners of Campus_12 are

1. Ramu Choudhary

2. Subhra Chakraborty


=========================================================

1. What is a const pointer?

Answer: Constant pointer is NOT pointer to constant. Constant pointer means the pointer is constant. For eg:Constant Pointerint * const ptr2 indicates that ptr2 is a pointer which is constant. This means that ptr2 cannot be made to point to another integer. However the integer pointed by ptr2 can be changed.

Where as a Pointer to constant is const int * ptr1 indicates that ptr1 is a pointer that points to a constant integer. The integer is constant and cannot be changed. However, the pointer ptr1 can be made to point to some other integer.

2. How can you determine the maximum value that a numeric variable can hold?

Answer: unsigned int y = 0;
--y;

now check the value of y. This would contain maximum value that an interger can have.now you can determine the values containing by the signed int.

=========================================================


Imprtant:Send answer of Campus_13 (C Question) top 10 right answer sender's name will be published on main page of sandeeoinfo.com
so send your answer quickly.

Process to send answerSend your answer along with your name and your college name to sandeepinfo@yahoo.co.in

Join http://groups.yahoo.com/group/campus_online/ for more updated information

Earn 1860 Rs/Month by reading SMS

Sunday, May 20, 2007

Campus_12 (Math - Aptitude)

Earn 1860 Rs/Month by reading SMS


1. I am three times as old as my son. Five years later I shall be two and a half times as old as my son. What is my age?

Answer: Let my age be x years and age of my son be y years.
(i) x = 3y
Five years later
(ii) x+5 = 5/2(y+5)
From (i) and (ii)
y=15 and x=45

2. The L.C.M. (Lowest (or Least) Common Multiple) of two numbers is 45 times to their H.C.F (Highest Common Factor). If one of the numbers is 125 and sum of L.C.M. and H.C.F. is
1150, the other number is:
a) 215
b) 220
c) 225
d) 235

Answer: Let L.C.M. be l and H.C.F. be h. Then l = 45h
l + h =1150
This gives h =25 and l = 1125
Thus the second number = (25 * 1125)/125 = 225

3. Six bells commence tolling together and toll at intervals 2,4,6,8,10 and 12 seconds respectively. In 30 minutes how many times they toll together.
a) 4
b) 10
c) 15
d) 16

Answer: L.C.M. of 2,4,6,8,10,12 = 120
So they toll together after every 120 seconds i.e. 2 minutes. So in 30 minutes they toll together 30/2 + 1 = 16 times

4. The value of (0.625 * 0.0729 * 28.9)/(0.0017 * 0.025 * 8.1) is
a) 3825
b) 3.825
c) 38.25
d) 382.5

Answer: The sum of decimal places in numerator and denominator being the same, decimal point can be removed
(625*729*289) / (17*25*81) = 3825


5. The number of coins 1.5 cm in diameter and 0.2cm thick to be melted to form a right circular cylinder of height 10 cm and diameter 4.5 cm is:
a) 380
b) 450
c) 472
d) 540

Answer: Volume of 1 coin = 22/7 *(1.5)/2*(1.5)/2 * 0.2 = 99/280 cm3
Volume of large cylinder = 22/7 *(4.5)/2*(4.5)/2 * 10 = (99*45)/28cm3
Number of coins = (99*45)/28 * 280/99 = 450


Imprtant:Send answer of Campus_12 (C Question) top 10 right answer sender's name will be published on main page of sandeeoinfo.com

so send your answer quickly.

Process to send answerSend your answer along with your name and your college name to sandeepinfo@yahoo.co.in

Join http://groups.yahoo.com/group/campus_online/ for more updated information


Earn 1860 Rs/Month by reading SMS

Monday, May 14, 2007

Campus_11

Earn 1860 Rs/Month by reading SMS

Today's Winner are

Deepak (from United College, Allahabad)

1. main()
{
int x=20;
{
int x=10;
printf(“%dn”,x);
}
printf(“%dn”,x);
}

Ans: 10
20

2. main()
{
int x=5;
x = x++;
printf (“%dn”,x);
}

Ans: 5

3. main()
{
int x=10;
printf(“%d %d”, ++x, ++x)
}

Ans: 12 11

4. What is the output of the following program if its command line argument were …
Sample 1 5 7

main(int argc, char *argv[])
{
int x;
x= argv[1] + argv[2] +argv[3]);
printf (“%d”, x);
}

Ans: Will show error because compiler treats 1 5 7 as characters array

5. # define VOLDEMORT he_who_must_not_be_names
main()
{
printf(“VOLDEMORT”);
}

Ans VOLDEMORT

Imprtant:
Send answer of Campus_11 (C Question) top 10 right answer sender's name will be published on main page of sandeeoinfo.com

so send your answer quickly.

Process to send answer
Send your answer along with your name and your college name to sandeepinfo@yahoo.co.in

Join http://groups.yahoo.com/group/campus_online/ for more updated information

Earn 1860 Rs/Month by reading SMS

Sunday, May 13, 2007

Campus_10 (C Question)

Find out the output of following:

1. main()
{
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
}

Answer : Compiler Error : Type mismatch in redeclaration of function display
Explanation :
In third line, when the function display is encountered, the compiler doesn't know anything about the function display. It assumes the arguments and return types to be integers, (which is the default type). When it sees the actual function display, the arguments and type contradicts with what it has assumed previously. Hence a compile time error occurs.

2. main()
{
int m=- -2;
printf("m=%d",m);
}

Answer: m=2;
Explanation:
Here unary minus (or negation) operator is used twice.
maths rules applies, minus * minus= plus.


3. #define int char
main()
{
int k=65;
printf("sizeof(k)=%d",sizeof(k));
}

Answer: sizeof(k)=1
Explanation:
Since the #define replaces the string int by the macro char


4. main()
{
int m=10;
m=!m>14;
printf("m=%d",m);
}

Answer: m=0


5. #include
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *q,*str,*str1;
q=&s[3];
str=q;
str1=s;
printf("%d",++*q + ++*str1-32);
}

Answer: 77
Explanation:
q is pointing to character '\n'. str1 is pointing to character 'a' ++*q. "q is pointing to '\n' and that is incremented by one." the ASCII value of '\n' is 10, which is then incremented to 11. The value of ++*q is 11. ++*str1, str1 is pointing to 'a' that is incremented by 1 and it becomes 'b'. ASCII value of 'b' is 98.
Now performing (11 + 98 – 32), we get 77("M"); So we get the output 77 :: "M" (Ascii is 77).

Thursday, May 10, 2007

Campus_9 (C Interview Questions)

1. When is a switch statement better than multiple if statements?
Answer: A switch statement is generally best to use when you have more than two conditional expressions based on a single variable of numeric type.

2. What are macros?
Answer: Macros are preprocessors which are small code of snippets which are replaced in the code AS IT IS before compilation of the program.

Preprocessor is a program that processes its input data to produce output that is used as input to another program.

3. What is the difference between goto and longjmp() and setjmp()?
Answer: A goto statement implements a local jump of program execution, and the longjmp() and setjmp() functions implement a nonlocal, or far, jump of program execution.
Generally, a jump in execution of any kind should be avoided because it is not considered good programming practice to use such statements as goto and longjmp in your program.
A goto statement simply bypasses code in your program and jumps to a predefined position. To use the goto statement, you give it a labeled position to jump to. This predefined position must be within the same function. You cannot implement gotos between functions.
When your program calls setjmp(), the current state of your program is saved in a structure of type jmp_buf. Later, your program can call the longjmp() function to restore the program’s state as it was when you called setjmp().Unlike the goto statement, the longjmp() and setjmp() functions do not need to be implemented in the same function. However, there is a major drawback to using these functions: your program, when restored to its previously saved state, will lose its references to any dynamically allocated memory between the longjmp() and the setjmp(). This means you will waste memory for every malloc() or calloc() you have implemented between your longjmp() and setjmp(), and your program will be horribly inefficient. It is highly recommended that you avoid using functions such as longjmp() and setjmp() because they, like the goto statement, are quite often an indication of poor programming practice.

4. What is an lvalue?
Answer: An lvalue is an expression to which a value can be assigned. The lvalue expression is located on the left side of an assignment statement, whereas an rvalue is located on the right side of an assignment statement. Each assignment statement must have an lvalue and an rvalue. The lvalue expression must reference a storable variable in memory. It cannot be a constant.

5. Array is an lvalue or not?
Answer: Basically lvalue is a storage location where data can be stored/ assigned and moreover it is not an expression. rvalue is an expression which has a value. all lvalues can be used as rvalues. But all rvalues can't be used as lvalues. int a[100];a is always an rvalue, but a[i] can be lvalue as well as rvalue

Wednesday, May 9, 2007

Campus_8 (OS question)

1. Explain the concept of Reentrancy.
Answer: It is a useful, memory-saving technique for multiprogrammed timesharing systems. A Reentrant Procedure is one in which multiple users can share a single copy of a program during the same period. Reentrancy has 2 key aspects: The program code cannot modify itself, and the local data for each user process must be stored separately. Thus, the permanent part is the code, and the temporary part is the pointer back to the calling program and local variables used by that program. Each execution instance is called activation. It executes the code in the permanent part, but has its own copy of local variables/parameters. The temporary part associated with each activation is the activation record. Generally, the activation record is kept on the stack.
Note: A reentrant procedure can be interrupted and called by an interrupting program, and still execute correctly on returning to the procedure.


2. Explain Belady's Anomaly.
Answer: Belady's Anomaly also called FIFO anomaly. Usually, on increasing the number of frames allocated to a process' virtual memory, the process execution is faster, because fewer page faults occur. Sometimes, the reverse happens, i.e., the execution time increases even when more frames are allocated to the process. This is Belady's Anomaly. This is true for certain page reference patterns.

3. What is a binary semaphore? What is its use?
Answer: A binary semaphore is one, which takes only 0 and 1 as values. They are used to implement mutual exclusion and synchronize concurrent processes.

4. What is thrashing?
Answer: It is a phenomenon in virtual memory schemes when the processor spends most of its time swapping pages, rather than executing instructions. This is due to an inordinate number of page faults.

5. List the Coffman's conditions that lead to a deadlock.
Answer:
1.Mutual Exclusion: Only one process may use a critical resource at a time.
2.Hold & Wait: A process may be allocated some resources while waiting for others.
3.No Pre-emption: No resource can be forcible removed from a process holding it.
4.Circular Wait: A closed chain of processes exist such that each process holds at least one
resource needed by another process in the chain.

Monday, May 7, 2007

Campus_7 (FAQ's)

Todays Winners are

1. Animesh from JP Institute , NOIDA
2. Mamta Singhar from IGIT, Delhi


Q1: Suppose a 3-bit sequence number is used in the selective-reject ARQ, what is the maximum number of frames that could be transmitted at a time?

A1: If a 3-bit sequence number is used, then it could distinguish 8 different frames. Since the number of frames that could be transmitted at a time is no greater half the numner of frames that could be distinguished by the sequence number, so at most 4 frames can be transmitted at a time

Q2: Describe Stacks and name a couple of places where stacks are useful.
A2: A Stack is a linear structure in which insertions and deletions are always made at one end, called the top. This updating policy is called last in, first out (LIFO). It is useful when we need to check some syntax errors, such as missing parentheses.

Q3: Describe one simple rehashing policy.
A3: The simplest rehashing policy is linear probing. Suppose a key K hashes to location i. Suppose other key occupies H[i]. The following function is used to generate alternative locations:

rehash(j) = (j + 1) mod h

where j is the location most recently probed. Initially j = i, the hash code for K. Notice that this version of rehash does not depend on K.

Q4: Write the pseudo code for the Depth first Search.
A4:
dfs(G, v) //OUTLINE
Mark v as “discovered”
For each vertex w such that edge vw is in G:
If w is undiscovered:
dfs(G, w); that is, explore vw, visit w, explore from there
as much as possible, and backtrack from w to v.
Otherwise:
“Check” vw without visiting w.
Mark v as “finished”


Q5: What are the advantages and disadvantages of B-star trees over Binary trees?
A5: B-star trees have better data structure and are faster in search than Binary trees, but it’s harder to write codes for B-start trees.

Sunday, May 6, 2007

Campus_6 (Quantitative Aptitude)

Todays Winner are:

Kamal - AKG Engineering College , Gaziabad
Swati - MIET, Meerut


1. Five boys were climbing a hill. J was following H. R was just ahead of G. K was between G & H. They were climbing up in a column. Who was the second?
Answer 1: G.
Explanation: The order in which they are climbing is R – G – K – H – J

2-5 John is undecided which of the four novels to buy. He is considering a spy
thriller, a Murder mystery, a Gothic romance and a science fiction novel. The books are written by Rothko, Gorky, Burchfield and Hopper, not necessary in that order, and published by Heron, Piegon, Blueja and sparrow, not necessary in that order.
(1) The book by Rothko is published by Sparrow.
(2) The Spy thriller is published by Heron.
(3) The science fiction novel is by Burchfield and is not published by Blueja.
(4)The Gothic romance is by Hopper.

2. Pigeon publishes ____________.

3. The novel by Gorky ________________.

4. John ­purchases books by the authors whose names come first and third in alphabetical order. He does not buy the books ­­______.

5. On the basis of the first paragraph and statement (2), (3) and (4) only, it is possible to deduce that
1. Rothko wrote the murder mystery or the spy thriller
2. Sparrow published the murder mystery or the spy thriller
3. The book by Burchfield is published by Sparrow.


Answer:
Novel Name Author Publisher
Spy thriller Rathko Heron
Murder mystery Gorky Piegon
Gothic romance Burchfield Blueja
Science fiction Hopper Sparrow

Explanation:
Given
Novel Name Author Publisher
Spy thriller Rathko Heron
Murder mystery Gorky Piegon
Gothic romance Burchfield Blueja
Science fiction Hopper Sparrow

Since Blueja doesn’t publish the novel by Burchfield and Heron publishes the novel spy thriller, Piegon publishes the novel by Burchfield.
Since Hopper writes Gothic romance and Heron publishes the novel spy thriller, Blueja publishes the novel by Hopper.
Since Heron publishes the novel spy thriller and Heron publishes the novel by Gorky, Gorky writes Spy thriller and Rathko writes Murder mystery.

6. If a light flashes every 6 seconds, how many times will it flash in ¾ of an hour?

Answer: 451 times.
Explanation: There are 60 minutes in an hour.
In ¾ of an hour there are (60 * ¾) minutes = 45 minutes.
In ¾ of an hour there are (60 * 45) seconds = 2700 seconds.
Light flashed for every 6 seconds.
In 2700 seconds 2700/6 = 450 times.
The count start after the first flash, the light will flashes 451 times in ¾ of an hour.

7. If point P is on line segment AB, then which of the following is always true?
(1) AP = PB (2) AP > PB (3) PB > AP (4) AB > AP (5) AB > AP + PB

Answer:
(4)
Explanation:
P
A -----------> B
Since p is a point on the line segment AB, AB > AP

8. All men are vertebrates. Some mammals are vertebrates. Which of the following conclusions drawn from the above statement is correct.
(a)All men are mammals
(b)All mammals are men
(c)Some vertebrates are mammals.
(d)None

Answer: (c)

9. Which of the following statements drawn from the given statements are correct?
Given:
All watches sold in that shop are of high standard. Some of the HMT watches are sold in that shop.
a) All watches of high standard were manufactured by HMT.
b) Some of the HMT watches are of high standard.
c) None of the HMT watches is of high standard.
d) Some of the HMT watches of high standard are sold in that shop.

Answer: (b) & (d).

Thursday, May 3, 2007

Campus_5( C Questions)

Predict the output or error(s) for the following:

1. void main()
{
int const * p=5;
printf("%d",++(*p));
}

Answer:
Compiler error: Cannot modify a constant value.
Explanation:
p is a pointer to a "constant integer". But we tried to change the value of the "constant integer".

2. main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}

Answer:
mmmm
aaaa
nnnn
Explanation:
s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally array name is the base address for that array. Here s is the base address. i is the index number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may be surprising. But in the case of C it is same as s[i].

3. main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}

Answer:
I hate U
Explanation:
For floating point numbers (float, double, long double) the values cannot be predicted exactly. Depending on the number of bytes, the precession with of the value represented varies. Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.
Rule of Thumb:
Never compare or at-least be cautious when using floating point numbers with relational operators (== , >, <, <=, >=,!= ) .

4. main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}

Answer: 5 4 3 2 1

Explanation:When static storage class is given, it is initialized once. The change in the value of a static variable is retained even between the function calls. Main is also treated like any other ordinary function, which can be called recursively.

5. main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++) {
printf(" %d ",*c);
++q; }
for(j=0;j<5;j++)
{
printf(" %d ",*p);
++p;
}
}

Answer: 2 2 2 2 2 2 3 4 6 5
Explanation:
Initially pointer c is assigned to both p and q. In the first loop, since only q is incremented and not c , the value 2 will be printed 5 times. In second loop p itself is incremented. So the values 2 3 4 6 5 will be printed.

6. main()
{
extern int i;
i=20;
printf("%d",i);
}

Answer:
Linker Error : Undefined symbol '_i'
Explanation:
extern storage class in the following declaration,
extern int i;
specifies to the compiler that the memory for i is allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of name i is available in any other program with memory space allocated for it. Hence a linker error has occurred .

7. main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&amp;amp;amp;j++&&k++l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}

Answer: 0 0 1 3 1
Explanation :
Logical operations always give a result of 1 or 0 . And also the logical AND (&&) operator has higher priority over the logical OR () operator. So the expression ‘i++ &&amp;amp; j++ && k++’ is executed first. The result of this expression is 0 (-1 &&amp;amp; -1 && 0 = 0). Now the expression is 0 2 which evaluates to 1 (because OR operator always gives 1 except for ‘0 0’ combination- for which it gives 0). So the value of m is 1. The values of other variables are also incremented by 1.

8. main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}

Answer: 1 2
Explanation:
The sizeof() operator gives the number of bytes taken by its operand. P is a character pointer, which needs one byte for storing its value (a character). Hence sizeof(*p) gives a value of 1. Since it needs two bytes to store the address of the character pointer sizeof(p) gives 2.

9. main()
{
int i=3;
switch(i)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
}

Answer : three
Explanation :
The default case can be placed anywhere inside the loop. It is executed only when all other cases doesn't match.

10. main()
{
printf("%x",-1<<4);
}

Answer: fff0
Explanation :
-1 is internally represented as all 1's. When left shifted four times the least significant 4 bits are filled with 0's.The %x format specifier specifies that the integer value be printed as a hexadecimal value.

Wednesday, May 2, 2007

Campus_4 (C,C++ questions)

Q: How many ways are there to initialize an int with a constant?
A: There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation.int foo = 123;int bar (123);

Q: Explain the scope resolution operator.
A: It permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.
The answer can get complicated. However, it should start with “::”. If the programmer is well into the design or use of classes that employ inheritance you might hear a lot about overriding member function overrides to explicitly call a function higher in the hierarchy. That’s good to know, but ask specifically about global scope resolution. You’re looking for a description of C++’s ability to override the particular C behavior where identifiers in the global scope are always hidden by like identifiers in a local scope.

Q: In C, why is the void pointer useful? When would you use it?
A: The void pointer is useful because it is a generic pointer that any pointer can be cast into and back again without loss of information.

Q: In C, what is the difference between a static variable and global variable?
A: A static variable declared outside of any function is accessible only to all the functions defined in the same file (as the static variable). However, a global variable can be accessed by any function (including the ones from different files).

Q: In C++, what is the difference between method overloading and method overriding?
A: Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters). Method overriding is the ability of the inherited class rewriting the virtual method of the base class.

Q: What is pure virtual function?
A: A class is made abstract by declaring one or more of its virtual functions to be pure. A pure virtual function is one with an initializer of = 0 in its declaration.

Q: What is a virtual destructor?
A: The simple answer is that a virtual destructor is one that is declared with the virtual attribute. The behavior of a virtual destructor is what is important. If you destroy an object through a pointer or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be complete.

Q: What is virtual channel?
A: Virtual channel is normally a connection from one source to one destination, although multicast connections are also permitted. The other name for virtual channel is virtual circuit.

Q: You have one base class virtual function how will call that function from derived class?
A: class a{public virtual int m(){return 1;}}
class b:a{public int j(){return m();}}

Q: Write a function that will reverse a string.
A: char *strrev(char *s)
{
int i = 0,
len = strlen(s);
char *str;
if ((str = (char *)malloc(len+1)) == NULL) /*cannot allocate memory */
err_num = 2;return (str);
}
while(len)str[i++]=s[?len];
str[i] = NULL;return (str);
}

Tuesday, May 1, 2007

Campus_3(Quantitative Aptitude)

1. It was calculated that 75 men could complete a piece of work in 20 days. When work was scheduled to commence, it was found necessary to send 25 men to another project. How much longer will it take to complete the work?

Answer 1: 30 days.
Explanation:
Before:
One day work = 1 / 20
One man’s one day work = 1 / ( 20 * 75)
Now:
No. Of workers = 50
One day work = 50 * 1 / ( 20 * 75)

The total no. of days required to complete the work = (75 * 20) / 50 = 30


2. A student divided a number by 2/3 when he required to multiply by 3/2. Calculate the percentage of error in his result.

Answer 2: 0 %

Explanation: Since 3x / 2 = x / (2 / 3)

3. A dishonest shopkeeper professes to sell pulses at the cost price, but he uses a false weight of 950gm. for a kg. His gain is …%.

Answer 3: 5.3 %

Explanation: He sells 950 grams of pulses and gains 50 grams.
If he sells 100 grams of pulses then he will gain (50 / 950) *100 = 5.26

4. A software engineer has the capability of thinking 100 lines of code in five minutes and can type 100 lines of code in 10 minutes. He takes a break for five minutes after every ten minutes. How many lines of codes will he complete typing after an hour?

Answer 4:
250 lines of codes

5. A man was engaged on a job for 30 days on the condition that he would get a wage of Rs. 10 for the day he works, but he have to pay a fine of Rs. 2 for each day of his absence. If he gets Rs. 216 at the end, he was absent for work for ... days.

Answer 5:
7 days

Explanation:
The equation portraying the given problem is:
10 * x – 2 * (30 – x) = 216 where x is the number of working days.
Solving this we get x = 23
Number of days he was absent was 7 (30-23) days.

6. A contractor agreeing to finish a work in 150 days, employed 75 men each working 8 hours daily. After 90 days, only 2/7 of the work was completed. Increasing the number of men by­­ ________ each working now for 10 hours daily, the work can be completed in time.

Answer 6: 150 men.

Explanation:
One day’s work = 2 / (7 * 90)
One hour’s work = 2 / (7 * 90 * 8)
One man’s work = 2 / (7 * 90 * 8 * 75)

The remaining work (5/7) has to be completed within 60 days, because the total number of days allotted for the project is 150 days.

So we get the equation

(2 * 10 * x * 60) / (7 * 90 * 8 * 75) = 5/7 where x is the number of men working after the 90th day.

We get x = 225
Since we have 75 men already, it is enough to add only 150 men.


7. what is a percent of b divided by b percent of a?
(a) a (b) b (c) 1 (d) 10 (d) 100

Answer 7 : (c) 1
Explanation:
a percent of b : (a/100) * b
b percent of a : (b/100) * a
a percent of b divided by b percent of a : ((a / 100 )*b) / (b/100) * a )) = 1

8. A man bought a horse and a cart. If he sold the horse at 10 % loss and the cart at 20 % gain, he would not lose anything; but if he sold the horse at 5% loss and the cart at 5% gain, he would lose Rs. 10 in the bargain. The amount paid by him was Rs.­­­­_______ for the horse and Rs.________ for the cart.

Answer 8 : Cost price of horse = Rs. 400 & the cost price of cart = 200.
Explanation:-
Let x be the cost price of the horse and y be the cost price of the cart.
In the first sale there is no loss or profit. (i.e.) The loss obtained is equal to the gain.

Therefore (10/100) * x = (20/100) * y

X = 2 * y -----------------(1)
In the second sale, he lost Rs. 10. (i.e.) The loss is greater than the profit by Rs. 10.

Therefore (5 / 100) * x = (5 / 100) * y + 10 -------(2)
Substituting (1) in (2) we get
(10 / 100) * y = (5 / 100) * y + 10
(5 / 100) * y = 10
y = 200
From (1) 2 * 200 = x = 400

9. A tennis marker is trying to put together a team of four players for a tennis tournament out of seven available. males - a, b and c; females – m, n, o and p. All players are of equal ability and there must be at least two males in the team. For a team of four, all players must be able to play with each other under the following restrictions:
b should not play with m,
c should not play with p, and
a should not play with o.
Which of the following statements must be false?
1. b and p cannot be selected together
2. c and o cannot be selected together
3. c and n cannot be selected together.


Answer 9 : 3.

Explanation:
Since inclusion of any male player will reject a female from the team. Since there should be four member in the team and only three males are available, the girl, n should included in the team always irrespective of others selection


10. Five farmers have 7, 9, 11, 13 & 14 apple trees, respectively in their orchards. Last year, each of them discovered that every tree in their own orchard bore exactly the same number of apples. Further, if the third farmer gives one apple to the first, and the fifth gives three to each of the second and the fourth, they would all have exactly the same number of apples. What were the yields per tree in the orchards of the third and fourth farmers?

Answer 10 : 11 & 9 apples per tree.

Explanation:
Let a, b, c, d & e be the total number of apples bored per year in A, B, C, D & E ‘s orchard.
Given that a + 1 = b + 3 = c – 1 = d + 3 = e – 6
But the question is to find the number of apples bored per tree in C and D ‘s orchard. If is enough to consider c – 1 = d + 3.
Since the number of trees in C’s orchard is 11 and that of D’s orchard is 13. Let x and y be the number of apples bored per tree in C & d ‘s orchard respectively.
Therefore 11 x – 1 = 13 y + 3
By trial and error method, we get the value for x and y as 11 and 9


Send the answer as soon as possible to sandeepkumar@sandeepinfo.com
First five correct answer sender's name will be displayed on main page of sandeepinfo.com
Please send your college and branch name also with your answer.

All the Best

Monday, April 30, 2007

Campus_2(SQL - Question)

1. Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
Data Definition Language (DDL)

2. What operator performs pattern matching?
LIKE operator

3. What operator tests column for the absence of data?
IS NULL operator

4. Which command executes the contents of a specified file?
START or @

5. What is the parameter substitution symbol used with INSERT INTO command?
&

6. Which command displays the SQL command in the SQL buffer, and then executes it?
RUN

7. What are the wildcards used for pattern matching?
_ for single character substitution and % for multi-character substitution

8. State true or false. EXISTS, SOME, ANY are operators in SQL.
True

9. State true or false. !=, <>, ^= all denote the same operation.
True

10. What are the privileges that can be granted on a table by a user to others?
Insert, update, delete, select, references, index, execute, alter, all

11. What command is used to get back the privileges offered by the GRANT command?
REVOKE

12. Which system tables contain information on privileges granted and privileges obtained?
USER_TAB_PRIVS_MADE, USER_TAB_PRIVS_RECD

13. Which system table contains information on constraints on all the tables created?
USER_CONSTRAINTS

14. TRUNCATE TABLE EMP;
DELETE FROM EMP;
Will the outputs of the above two commands differ?
Both will result in deleting all the rows in the table EMP.

15. What is the difference between TRUNCATE and DELETE commands?
TRUNCATE is a DDL command whereas DELETE is a DML command. Hence DELETE operation can be rolled back, but TRUNCATE operation cannot be rolled back. WHERE clause can be used with DELETE and not with TRUNCATE.

Campus_1 (C++ Question)

1. What will print out?
main()
{
char *p1=“name”;
char *p2;
p2=(char*)malloc(20);
memset (p2, 0, 20);
while(*p2++ = *p1++);
printf(“%s\n”,p2);
}

Answer:empty string.

2. What will be printed as the result of the operation below:
main()
{
int x=20,y=35;
x=y++ + x++;
y= ++y + ++x;
printf(“%d%d\n”,x,y);
}

Answer : 5794

3. What will be printed as the result of the operation below:
main()
{
int x=5;
printf(“%d,%d,%d\n”,x,x< <2,x>>2);
}

Answer: 5,20,1

4. What will be printed as the result of the operation below:
#define swap(a,b) a=a+b;b=a-b;a=a-b;
void main()
{
int x=5, y=10;
swap (x,y);
printf(“%d %d\n”,x,y);
swap2(x,y);
printf(“%d %d\n”,x,y);
}
int swap2(int a, int b)
{
int temp;
temp=a;
b=a;
a=temp;
return 0;
}

Answer: 10, 510, 5

5. What will be printed as the result of the operation below:
main()
{
char *ptr = ” Cisco Systems”;
*ptr++;
printf(“%s\n”,ptr);
ptr++;
printf(“%s\n”,ptr);
}

Answer:Cisco Systemsisco systems

6. What will be printed as the result of the operation below:
main()
{
char s1[]=“Cisco”;
char s2[]= “systems”;
printf(“%s”,s1);
}

Answer: Cisco

7. What will be printed as the result of the operation below:
main()
{
char *p1;
char *p2;
p1=(char *)malloc(25);
p2=(char *)malloc(25);
strcpy(p1,”Cisco”); s
trcpy(p2,“systems”);
strcat(p1,p2);
printf(“%s”,p1);
}

Answer: Ciscosystems

8. The following variable is available in file1.c, who can access it?:
static int average;
Answer: all the functions in the file1.c can access the variable.

9. WHat will be the result of the following code?
#define TRUE 0 // some code
while(TRUE)
{
// some code
}

Answer: This will not go into the loop as TRUE is defined as 0.

10. What will be printed as the result of the operation below:
int x;
int modifyvalue()
{
return(x+=10);
}
int changevalue(int x)
{
return(x+=1);
}

void main()
{
int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output:%d\n",x);
x++;
changevalue(x);
printf("Second output:%d\n",x);
modifyvalue();
printf("Third output:%d\n",x);
}

Answer: 12 , 13 , 13

11. What will be printed as the result of the operation below:
main()
{
int x=10, y=15;
x = x++;
y = ++y;
printf(“%d %d\n”,x,y);
}

Answer: 11, 16

12. What will be printed as the result of the operation below:
main()
{
int a=0;
if(a==0) printf(“Cisco Systems\n”);
printf(“Cisco Systems\n”);
}

Answer: Two lines with “Cisco Systems” will be printed.

All The Best friends