Thursday 30 July 2015

WIPRO Solved Placement Questions Papers 2015

 Solved Placement Question Paper 2015

1) Write a Program for the following pattern?
if input = 2
pattern: 

     1*2

     3*4

if input = 5

pattern:

     1*2*3*4*5

     6*7*8*9*10
     11*12*13*14*15
     16*17*18*19*20
     21*22*23*24*25

C Program:

#include< stdio.h >
#include< conio.h >
void main( )
{
           int n, i, p;
           clrscr( );
           printf("\nEnter N Value: ");
           scanf("%d",&n);
           p = n*n;
           for(i = 1; i<=  p; i++)
          {
                  if(i <= p)
                 {
                           printf("%d",i);
                           if((i < p) && (i % n != 0))
                          {
                                   printf("*");
                           }
                 }
                 if(i % n == 0)
                {
                         printf("\n");
                 }
         }
         getch( );
}



2)  What is the output of the following program?

#include< stdio.h >
#include< conio.h >
void main( )
{
         int i = 65;
         printf("%d %o %x",i,i,i);
}

Answer: 65 101 41

3) In breadth-first-search(BFS) search, which of the following option is correct?

Answer: It is begining from node and first all its adjacent nodes are traversed.





Monday 20 July 2015

Swapping of two numbers using Bit wise Operators in C language



Program:

/* C Program for Swapping of two numbers using Bit wise Operators */
#include < stdio.h >
void main(  )
{
        int a, b;

        a = 10;
        b = 20;
        a = a ^ b;
        b = a ^ b;
        a = b ^ a;
        printf("\n a = %d\t b = %d", a, b);
}

Output:

a = 20    b = 10





Sunday 5 July 2015

C Programs asked in TCS


Program:

#include<stdio.h>
#include<conio.h>
int main( )
{
       enum status
       {
              pass,fail,dist
        };
        enum status student1, student2, student3;
        student1 = pass;
        student2 = dist;
        student3 = fail;
        printf("%d,%d,%d",student1,student2,student3);
        return 0;
}

Output:


0,2,1