Search here

Custom Search

5/28/2012

Part 1: FRP Dumps | C Puzzle | C++ Puzzle | DataStructure Puzzle

FRP Dumps for Engineering Graduates:-

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

Wipro Online Exams conducted during training are based on Multiple Choice Questions.Database Contains around 1000 Questions based on C,C++ and Data Structure. During Exam ,Application will pick randomly 50 questions from Database for each and everyone. While I am writing FRP, I got more Questions(97%) from this Dumps(but with different input and slight variation in question).Understanding the logic of each and every puzzle is very important, if possible work out in turbo c. I Scored 86 in FRP. All the Engineering Graduates(Includes MCA,MS..) have to go through this FRP Exam. Click here to share with your friend

 Part 1:-

1)         If you dont know the array size which one do you prefer?
                        a) array
                        b) linked list
ans::b


2)         what is the postfix of the given infix expression
               (a+b)*c/d-e+f
ans::ab+c*d/e-f+

3)         void main()
            {
               int i,*j;
               i=35;
               ??????//j=&i;
               printf("%d",*j);
            }
            To get the 35 as the output,which statement is replaced by ??????


4)         To print a single character in ouptut,which function is used?
            a) getchar()
            b) gets()
            c) putchar()
            d) puts()
            ans::c


5)         The effective way of sorting is done by _______________
            a) single linked list
            b) arrays
            C) Doubly linked list
            d) Binary search trees
            ans::c or d??


6)         void main()
            {
            struct emp
            {
               int a;
               struct emp b;
            };
            struct emp m;
            printf("%d",sizeof(m));
            }
            ans::error

7)         #define t 10
            void main()
            {
               printf("%d",t);
            }
                        a) 10
                        b) Error:Unfined symbol 't'
                        c) Error:Improper placement of preprocessor
                        d) none of the above

            ans::a
8)         data structures used for stack
            a) array
            b) linked list
            c) both
            d) none
            ans::c
9)      Explicit datatype conversion is called
            a) Type casting
            b) conversion
            c) separation
            d) none
            ans::a
10)       what is the size of char *a,int *b,float *q,if the size of the
            double pointer is 2 bytes
                        a) 1 1 1
                        b) 2 2 2
                        c) 4 4 4
                        d) 1 2 4
                        ans::b

11)       The data structure used for searching is
            a) arrays
            b) single linked list
            c) double linked list
            D) Binary search trees
            ans::d
12)       For what purpose queues are used?
                        i) expression evaluation
                        ii) device queue for processes
            a) i only
            b) ii only
            c) both i and ii
            d) neither i nor ii
            ans::b

13)       The data structure used for sorting without moving the data is
            a) arrays
            b) single linked list
            c) double linked list
            D) Binary search trees            
            ans::d


14)       struct stack
            {
                        int a[10];
                        int top;
            };
            struct stack *s;

How will add an element called 'item' in top the stack?
ans::s->a[s->top]=item


15)       predict the ouput

            strcut emp
            {
                        char name[50];
                        struct emp e;
            }*oemp;

            oemp->name="wipro";
            ans::error


16)       Predict the output

            struct a
            {
                        int x;
            }e1;
            struct b
            {
                        int y;
            }e2;
            if(e1==e2)//structure cannot be comapred simplys
            printf("Equal");
            else
            printf("Unequal");

            ans::error
17)       main()
            {
                        int i,j;
            for(i=0;i<2;i++)                                   //wipro would be printed 8 times
            {
                        for(j=0;j<5;j++)
                        {
                        if(i==j)
                                    continue;
                        printf("wipro");
                        }
            }
            }



18)       which one is used to get a multiword string?
            a) gets
            b) printf
            c) puts
            d) getchar
            ans::a.

19)       main()
            {
                        char *a="\12345\n";
                        printf("%d",sizeof(a));
            }
            ans::2

20)       int fun()
            {
                        int k=10;
                        return(&k);
            }
            main()
            {
                        int *p;
                        p=fun();
                        printf("%d",*p);
            }
            ans::10
21)       i) char *str="welcome";
            ii) char str[50]="welcome";
for these 2 definitions will they give you the same output for the given statement?
            printf("%c",str[3]);
            yes

22)       void fun()
            {
                        return(a>100?100:200);
            }
            void main()
            {
                        printf("%d",fun(5));
            }
            ans::error

23)       void disp(int a,int b)
            {
                        return(a>b?a+b:a*b);
            }
            void main()
            {
                        printf("%d",,disp(5,6));
            }
            ans::error



            1) void main()
    {
            int i=0;
        while(i==0)
        { 
        }
           
    printf("%d",i);
   }
ans:: no output//infinte loop

2)         void main()
            {
                        int i=1;
                        while(++i==1)
                        {}
           
                        printf("%d",i);
            }
           
            ans::2
3)         char s[]={'a','b','c','\0'};
            printf("%s",s);
            output::abc

4)         int arr[3][3]={2,3,4, 5,6,7, 8,9,10};
            for(i=0;i<=2;i++)

            for(j=0;j<=2;++j)
            printf("%d",*(*(arr+i)+j));
            //*(arr[i]+j)--arr[i][j]
            output=2345678910

5)         int b=20;
            printf("%d",++*&b);
            ans::21

6)         which can be replaced by a switch block?
            a) do..while
            b) for
            c) while
            d) else if
            ans::d

7)         which of these is not a operator in c?
            a) ~
            b) ^
            c) %
            d) ::
            ans: d::
8)         which of these is not a valid character constant
            a) "A"
            b) '*'
            c) '+'
            d) 'h'
            ans::a
9)         struct student
            {
               int i;
               char c[10];
               struct student *s;
            };
            struct student stud,*stu;
            stu=&stud;
            printf("%d  %d",sizeof(stud));
            ans::14

10)       insert(root,2);
            insert(root,1);
            insert(root,3);
            insert(root,4);
            insert(root,5);
            What is the inorder for the above tree?
            ans::1,2,3,4,5


11)       insert(root,2);
            insert(root,1);
            insert(root,3);
            insert(root,4);
            insert(root,5);
            What is the preorder for the above tree?
            ans::2,1,3,4,5

12)       The postfix expression is ab+c*d/e-.If the values of a,b,c,d,e are 5,2,3,3,1
            respectively,then what will be the output?
            ans::6

13)       What is the order in which the preorder is evaluated?          
                        i) root node
                        ii) left node
                        iii) right node

            a) i,ii,iii
            b) ii,iii,i
            c) iii,ii,i
            d) ii,i,iii

            ans::a
14)       which operations are more effective in linked list than arrays?
            i) insertion
            ii) deletion
            iii) traversal

                        a) i,ii only
                        b) iii only
                        c) all the above
                        d) i,iii only
ans::a
15)       what is the output of the following program?

            void main()
            {
               int i=12;
               int *q;
               q=&i;
               *q=*q-8;
            printf("%d",i);
            }
            ans::4
16)       what is the use of precedence in C programs for operators?
            a) Precendence are used to replace the variables used in operations
            b) precendence are used to allocate memory space
            c) precendence are used to evaluate the expression first
            d) None of the above
            ans::c


17)       aaa(){ printf("Hai")};
            bbb(){ printf("Hello")};
            ccc(){ printf("Bye")};
            void main()
            {
               int (*ptr[3])();
               ptr[0]=aaa;
               ptr[1]=bbb;
               ptr[2]=ccc;
            }
ans::nothing it will print to call function we should write (*ptr[0])();


18)       In Unsigned char,signed value is represented by 1 in most significant bit.   
                        a) true
                        b) false
            ans::b
19)       int i=1;
            switch(i*2)
            {
              case 1:
                        printf("case1");
                        break;
              case 2:
                        printf("case 2");
              default:         
                        printf("default");
                    break;
            }
            a) case1 case2 default
            b) case2
            c) case2 default
            d) compiler error
            ans::c
20)       struct node
            {
               int info;
               struct node *left,*right;
            };
            if nd is a pointer which is pointing to the first node,then which one of the
            following is correct?
                        a) nd->right = NULL;
                        b) nd->left = NULL;
                        c) nd = NuLL;
                        d) nd->left->right = NULL;
            ans::b


21)       struct a
            {
              char *i;
              char *j;
            };
            struct b
            {
              struct a x;
              int i;
            }*y;
            printf("%d %d",sizeof(y),sizeof(*y));

            ans::2 6           
22)       #define t printf
            void main()
            {
            int i=10;
            t("%d",i);
            } 
            ans::10                                   
           
23)       int a[3][4]={1,2,3,4, 5};
            printf("%d",a[0][4]);
            ans::5

24)       which one is used to check the given string is palindrome or not
            a) Single Linked list
            b) doubly linked list
            c) Arrays
            D) none of the above
            ans::c

25)       #define HELLO hai
            void main()
            {
              printf("HELLO");
            }
            ans::hello
26)       The formal arguments has a default value zero
            a) true
            b) false
            ans::b
27)       void fun()
            {
              ?????
              x++;
              printf("%d",x);
            }
            int x;
            void main()
            {
              x=7;
              printf("%d",x);
               x++;
              printf("%d",x);
            fun();
            }
            if the outputs are 7,8,9,then which is replaced instead of ?????
                        a) extern int x;
                        b) auto int x;
                        c) static int x;
                        d) register int x;
            ans::a

28)       if rear=-1,front=-1 then what will be my queue?
                        a) Queue is empty
                        b) Queue is full
                        c) Queue has one element
                        D) Queue has max-1 element
            ans::a
29)       void main()
            {
                        int i;
                        for(i=1;i<=5;i++)
                                    {}
                             printf("%d",i);
             }
            ans::6

30)       If p=(int *) malloc(sizeof(int)*10),then which one is true?
                        i) It allocates 20 bytes of memory
                        ii) The value in the memory is allocated to zero
            a) i only
            b)ii only
            c) both i and ii
            d) neither i nor ii
            ans::a
31)       If p=(int *) calloc(sizeof(int)*10),then which one is true?
                        i) It allocates 20 bytes of memory
                        ii) The value in the memory is allocated to zero
            a) i only
            b)ii only
            c) both i and ii
            d) neither i nor ii
            ans::c

32) Predict the output
           
            int i=1;
            while(i<3)
            {
                        switch(i)
                        {
                                    case 1:
                                                printf ("Case 1");
                                                break;
                                    case 2:
                                                printf ("case 2");
                                                break;
                                    default:
                                                printf ("Default");
                        }
                        i++:
            }
            ans::case1 case2
33) If rear=0 front=0 what is queue?
            ans::queue has one element
34) if rear=max, front=0, what is queue?
            ans::q is full
35) for (i=1; i=2; i++)
            {
                        printf ("HAI");
            }
            ans::hai hai hai....infinite

36)       *Consider a linked list where ptr is a pointer which is not pointing to the
            first node and not to the last node. If there is another node called "new" which
            is like new->next=NULL, then what is the scenario?
                        a) It is the first node
                        b) It is the last node
                        c) It is in the middle
                        d) none of these
            ans::b

37)       If 'a' is the integer which is not statically initialized then what is the value of 'a'?
                        a) zero
                        b) garbage
                        c) none of these
            ans::b
38)       struct emp
            {
                int a=20;//intialization cannot be done here..
                char name[10]="AAA";
            };
            void main()
            {
               struct emp oemp;
               printf("%s",oemp->name);
               printf("%d",oemp->a);
            }

            ans::error//if struct element cannot be intialized +oemp cannot use -> only ".".
39)       Which of the following is considered as tokens in C?
                        a) Variables
                        b) Keywords
                        c) Constants
                        d) All the above
            ans::d

40)       C is a ____________________ language
                        a) Platform independent programming
                        b)  Platform dependent programming
                        c) Object oriented programming
                        d) None of the above
                        ans::b
41)       main()
            {
               int i=3;
                switch(i)
                {
                        default: printf("default");
                        case 1: printf("case 1");
                        case 2: printf("case 2");          
                                    break;
                }
            ans::default case1 case2         
42)       #define FIRST 1
            #define SECOND FIRST+FIRST    
            main()
            {
              printf("%d",SECOND * SECOND);
            }
            ans::3
43)       int b[5];
            main()
            {
               static int a[5];
                int i;
                        for(i=0;i<5;i++)
                        printf("%d %d",a[i],b[i]);
            }
            output::o o o o o o o o o o
44)       which is having the more precendence
            a) * b)+ c)== d) -
            ans::a

45)     main()
            {
              char *x="girl";
              int n,i;
               n=strlen(x);
              *x=x[n];//g will be replaced by \0
              for(i=0;i<n;i++)
            {
               printf("%s \n",x);//   //irl//rl//r//
                x++;
            }
            }
ans::    
            irl
            rl
            l

46)       int sample(int x)
            {
               int *y;
                y=&x;
               x=*y+2;
               return(x);     
            }
            void main()
            {
               int x=5;
                printf("%d",sample(x));
            }

            ans::7

47)       void main()
            {
              int *j,*k;
               int a=5,b=8;
              j=&a;
              k=&b;
              j=j*2;
              k=j/2;
              printf("%d %d",*j,*k);
            }         
            ans::error//mul n div cannot be done on pointers
                       
48)       To make a pointer 'cursor'as a tail node,which line is correct
                        a) cursor->right==NULL
                        b) cursor->left==NULL
                        c) cursor==NULL
                        d) cursor->left==0
            ans::a

49)       Single linked list has a lnk to the next address
                        a) true
                        b) false
            ans::a

50)       int 5[x]={1,2,3,4,5};
            printf("%d",2[x]);
            ans::error//declaration terminated incorrectly

51)       int arr[]={1,2,3,4,5};
            printf("%d %d",arr,&arr);
            garbage garbage//same both array statrting address
           
52)       int a[3][4]={1,2,3,4, 5,6,7,8 ,9,0};
            printf("%d %d",a,a[2][1]);
            ans::garbage(%u sud be used)  0

53)       The argc,argv are initialised in
                        a) header file
                        b) within main
                        c) outside main
                        d) none
            ans::a

54)       Queue is
                        i) First in first out
                        ii) used in expression evaluation.
            a) i only
            b) ii only
            c) both i and ii
            d) neither i nor ii
            ans::a
55)       which is correct?
            a) Auto variables are local variables
            b) Extern variables are global variables
            c) static variables are global variables
            d) registers are local variables
            ans::b
56)       main()
            {
              int i=5;
              int *p;
               p=&5;
               printf("%d %d",i,*p);
            }         

            ans::error//must take an adress of a variable
57)       int foo(int a,float b)
            {
               float c;
               c=(float)a+b;
            printf("%c",c);
            }
            main()
            {
              ?????
              foo(8,12.5);
            }
            which line is replaced for ?????? to get the ouput of 20.5
            ans::nuthing//not reqd %f sud be used tats it

58)       main()
            {
               float v;
               v=10/4.0;
              printf("%f",v);
            }

            ans::2.5000000

59)       In a doubly linked list, p1 and p2 are the 2 nodes and node nd is inserted as
               nd->next=NULL
               nd->prev=p1->next
            ans::watever the question nd is last node till data provided
60)     void main()
            {
              int i=12,j,*p;
               p=&i;
              j=++*p+8;
             printf("%d",j);
            }
            ans::21
           
1.int a=123.12;
  int b=-123.12;
  int c=a+b;
  printf("%2f",c);

  a) 0.00
  b) 123.12
  c) 246.24
  d) None of these
ans::none of these abnormal floating point

2. struct emp
     {
        int a;
        char *name;
     };
    main()
     {
       struct emp *e;
       printf("%d",sizeof(e));
     }

ans::2

3.  which is the best thing for linked list than arrays?
    i) Insertion
    ii) Deletion
    iii) Traversal

   a)  (i)   only
   b) (i),(ii) only
   c)  ii,iii only
   d) iii only
ans::b

4. consider the character array of size 10.When a string is more than 10
   
    a) Error
    b) Overwrites
    c) Nothing
    d) garbage value
            ans::error/too many intializers
ans::a
5.  main()
    {
      char *str;
      char *fun();
       str=fun();
      printf("%s",str);
   }
   
   char * fun()
    {
      char *buffer;
      strcpy(buffer,"Hello world");
        return buffer;
    } 
ans::runtime error //as buffer is lost when it goes out of a function bettet to use static char *buffer 
            or malloc to allocate memory for buffer.
  a) hello world
  b) Compiler error
  c) Runtime error
  d) None of the above
ans::c
6.  main()
    {
      char *str;
      char *fun();
        str=fun();
      printf("%s",str);
   }
    
   char * fun()
    {
      char *buffer;
      buffer=(char *) malloc(sizeof(char));
      strcpy(buffer,"Hello world");
        return buffer;
    } 
             

  a) hello world
  b) Compiler error
  c) Runtime error
  d) None of the above

ans::a
7) what is the prefix expression for the given Infix expression  A+B*C/D

            ans::+a/*bcd
8) int a;
   a=65535;
   printf("%d",a);
   
    a) 0
    b) Garbage
    c) 65535
    d) -32768       
output::garbage
ans::to be precise will be -1//key here if no>+32767 then o/p is -(65536-number) and if no<-32768 then
            no=(65536+(-no));
9) main()
   {
     char p=65;
     printf("%c",p);
  }

  a) 65  b) p c) error d) none of the above
            ans::none of the above//aoutput capital "A"
10) In a function call, _____________ is passed as arguments.
      a) variables
      b) constants
      c) Expressions
      d) All the above
            all the above
11) The value of EOF is 26__-1_______.
            ascII=26
12) () is used for __________
   
    a) function body
    b) Arguments
    c) Return type
    d) Declaration of function
            ans::b

13) How does the string ends?

            a) /n
            b) /t
            c) /0
            d) none
            ans::none...\\it terminated by'\0'not/0 ok
14) The range of Unsigned integer is

            a) 127 to -128
            b) 0 to 65535
            c) Depend up on the compiler
            d) -32768 to 32767
            ans::c
15)  which one of the following is a illegal real constants

            a) 32.535
            b) -1.5E25 to 3.5E65
            c) "53682"
            d) -6.583
            ans::"53682"
16) main()
    {
      int i,a[5];               
        a[1]=5;
      for(i=0;i<5;i++)
            {
           printf("%d",a[i]);
               a++;
            }
}
            a) 0 0 0 0 0
            b) Garbage value
            c) 0 5 0 0 0
            d) Compiler error
            ans::d
17) The size of int is 2 bytes,then what is the size of short int?
            a) 1
            b) 2
            c) 4
            d) 8
            ans::b
18) In a queue,what condition applies

            a) First In First Out
            b) Last in first out
            c) Elements are inserted and deleted at one end
            d) Elements can be inserted and deleted in different ends
ans::a
19) which of the following statements are true in the case of doubly linked list
             i) Every node is connected to other node
        ii) We can traverse in both the directions

            a) i) only
            b)ii) only
            c) Both i and ii
            d) neither i nor ii

ans::c
20) main()
     {
       char str[]="Wipro Infotech";
            char *s;
       s=&str[13]-13;
       while(*s)
          printf("%c",*s++);  //*(s++)
   }      
ans::wipro infotech

21) char *a="Malayalam";
    char *s;
    Char *str;
    str=a;
    s=str+8;
    for(;s>=str;s--)
      printf("%c",*s);

    a) Malayalam
    b) malayalaM
    c) error
    d) None of the above
ans::b
22) struct main
     {
       int a;
       int b;
       struct main *e1;
     };
      printf("%d %d",sizeof(e1),sizeof(*e1));

ans::2 6
23)  #define wipro Hai
      void main()
       {
         printf("wipro");
  
            }
            ans::wipro
24) Is allocating a block of  memory effectively the same as defining an array?
     a) True
     b) false
            ans::false

25)  the size of a node of a doubly linked list is always greater than the single linked list
      a) True
      b) false
            ans::true
26) Queue is used for
        i) Expression Evaluation
        ii) Scheluding the job in First come First serve

                        a) i) only
                        b) ii only
                        c) both i & ii
                        d) neither i nor ii
            ans::b
27) what should be replace ????? in the program to get the output 25?

            ?????
            void main()
            {
              int x=2,y=3,j;
               j=SQRT(x+y);
             printf("%d",j);
        }
  
            a) #define SQRT(int) (int * int)
            b) #define SQRT(int) (int) * (int)
            c) #define SQRT(int) (int + int)         
            d) #define SQRT(int) (int) + (int)
            ans::b

28) void fun()
            {
              static char p[]="Hello";
              return p;
            }
 
            main()
            {
              printf("%s",fun());
            }
       what will be the output?
           
            a) Compiler Error  b) Hello  c) Garbage value   d) None
ans::a  

29) void main()
            {
          int *p;
               p=(int *)malloc(sizeof(int));
               for(i=0;i<5;i++)
                 printf("%d ",p[i]);
            }
    What is the output?
            ans::garbage
            if calloc is used o/p is 00000
30)  main()
            {
                   int i,j;
                   for(i=1,j=10;i<j;i++,j--);
                       printf("%d %d",i,j);
            }
            ans::1 10,2 9,3 8,4 7,5 6

31)   Which of these will pass the address of the pointer *ptr to the function demofun()?

            a) demofun(ptr)   b) demofun(&ptr)  
            c) demofun(*ptr) d) demofun(*&*ptr);                        
            ans::b

32) which is not a valid expression
            a) x!=y   b) x!   c) !x   d) x!y

            ans::x! and x!y
33)  If max=10,rear=max,front=0,then what will be my queue?

            a) Queue Empty
            b) Queue Full
            c) Queue has one element
        d) Queue has max-1 elements

ans::c or b??
34) which is an indefinite loop?
            a) do while(0);
            b) for(;0;);
            c) while(1);
            d) while(0);
            ans::c
35) int *ptr;
    ptr=(int *)malloc(10*sizeof(int));
which is correct?
       i) All Values are intialised to garbage values
            ii) Creates memory for 10 integer data

            a) i only
            b) ii only
            c) both i and ii
            d) neither i nor ii

ans::c
36) int *ptr;
    ptr=(int *)calloc(10*sizeof(int));
            which is correct?
       i) All Values are intialised to zero
            ii) Creates memory for 10 integer data

            a) i only
            b) ii only
            c) both i and ii
            d) neither i nor ii

ans::b
37)   Struct queue
            {
           int rear;
               int front;
           int a[100];
            }
       struct queue *q;
  then  how will you add a new element called 'item' in the queue?


            a) q->rear[a]=item;                             
            b) q->a[q->rear]=item;
            c) q->a[rear]=item;
            d) q->rear[q->a]=item;
            ans::b


38) In which of the following we can sort the data without moving the data                      

            a) Array
            b) Single Linked list
            c) Doubly linked list
            d) Binary search trees
            ans::d

39)       Char d=128;
        printf("%c",d);

            a)128
            b)-128
            c)error
            d)Garbage values
            ans::d
           
40) In the following definition
            struct node *ptr;
            ptr=(struct node *)calloc(sizeof(ptr));
                 
            a) ptr is allocated 4 bytes
            b) ptr will be allocated sizeof struct node
            c) Error
            d) ptr will have 8 bytes
            ans::a
41)   In a doubly linked list ,if the first node is first and the last node is end,
            what will be the output?

            traverse(struct node*end)
            {
                        while(end!=NULL)
                        traverse(end->prev);
                        printf("%d",end->data);
            }

       if the input is 1,2,3,4,5 then the output will be

            a) 1,2,3,4,5
            b) 5,4,3,2,1
            c) compilation error
            d) none
            ans::b
42) void main()
            {
                        int b=20;
                        printf("%d"*&b++);
            }
what will be the output?
            a) 21   b)20 c) error  d) Garbage value
            ans::c//must take an adress of memory location
            *&b will work
43) how will you refer the last node in the doubly linked list which is pointed by the pointer
            variable 'cursor'?
            a)cursor==NULL
            b)cursor->link=NULL
            c)Cursor->link=0
            d)cursor->data=NULL
ans::b

44) how will you refer the previous node of the pointer 'cursor' in the doubly linked list
            (cursor is not in the first or in the last)?
            a)cursor->link++
            b)cursor=cursor->left
            c) Cursor++
            d) cursor->left++
            ans::b










1)Consider the following structure
   struct node
    {
      int info;
      struct node *link;
    };
        Suppose ptr is a pointer which is not pointing to the first or
the last node.Then if we are going to delete a node after ptr,
then the code will be

a) ptr=ptr->link;
b) ptr->link=ptr;
c) ptr->link=ptr->link->link;
d) ptr=ptr->link->link;
ans::c



2)  Consider the following structure
   struct node
    {
      int info;
      struct node *link;
    };


Suppose start is a pointer pointing to the first node of the linked list.
s1 and ptr are the two pointers(they are not pointing to the first or
last node).Then if we are going to execute the following code,

i)   start->link=s1;
ii)  s1->link=ptr;
iii) ptr->link=start;

then the list is

a)  It is having only 3 nodes with start,s1,ptr in the list,having start as the first node
b)  It is a circular linked list
c)  It is a doubly linked list
d)  None of the above
ans::b

3) In a queue, if rear=front then what will be the queue
a)  Queue is empty
b)  Queue is full
c)  Queue has only one element
d)  none of the above
ans::c

4) In a queue,if rear=0,front=0 then what will be the queue
a)  Queue is empty
b)  Queue is full
c)  Queue has only one element
d)  none of the above
ans::c

5)  4) In a queue,if rear=0,front=1 then what will be the queue
a)  Queue is empty
b)  Queue is full
c)  Queue has only one element
d)  Queue is circular   
ans::d
                         
6) In a queue,if rear=-1,front=-1 then what will be the queue
a)  Queue is empty
b)  Queue is full
c)  Queue has only one element
d)  none of the above 
ans::a   
7) In a queue,if rear=max-1,front=0 then what will be the queue
a)  Queue is empty
b)  Queue is full
c)  Queue has only one element
d)  none of the above
ans::b

8) The postfix expression is ab+c*d/e-.The values of a,b,c,d,e are 2,4,5,2,1
    respectively. Then the output is

   a)  14
   b)  11
   c)  20
   d)  15
ans::a

9) The infix expression is a+b*(c-d)/(e+f)*h then my postfix expression is
    a) ab+cd-*ef+h*/
    b) abcd-ef+*/h*
    c) abcd-*ef+/h*+
    d) abcdef+-*/h*+
ans::c
10) In the stack,if top=0 then the stack is
    a)  stack is empty
    b)  stack is full
    c)  stack has only one element
    d)  none of the above           
ans::c


11)  Conside the structure
       struct node
            {
            int info;
                Struct node *left;
            struct node *right;
            };
       We have 10 elements in the list.If the following executes what will be the output?
            for(ptr=start;ptr;ptr=ptr->right)
            {
              if(ptr->data%2==0)
               printf("%d",ptr->data);
            }
  
a) Only even numbers are printed
b) Only odd numbers are printed
c) Compiler error
d) Only garbage values
ans::c /well if ptr is defined then even no are printed

12) Struct node
            {
               int data;
               struct node *left,*right;
            };
  Suppose nd is a node which is not in the beginning and also not in the end.
            How will you delete a node after nd?



a) nd->right=nd->right->left;nd->right->left=nd->left->right;
b) nd->right=nd->right->right;nd->right->left=nd;
c) nd->right=nd->right->left;nd->right->left=nd->right;
d) nd->right=nd->left->right;nd->left->right=nd;
ans::b

13) Struct node
            {
               int data;
               struct node *left,*right;
            };
  Suppose nd is a node which is not in the beginning and also not in the end.
            How will you delete a node before nd?



a) nd->left=nd->right->left;nd->right->left=nd->left->right;
b) nd->left=nd->right->right;nd->left->right=nd->right;
c) nd->left=nd->left->left;nd->left->right=nd;
d) nd->left=nd->left->right;nd->left->right=nd;
ans::c

14) Struct node
            {
               int data;
               struct node *left,*right;
            };
  Suppose ptr is a node which is not in the beginning and also not in the end.
            How will you delete a node ptr?



a) ptr->left->right=ptr->right;ptr->right->left=ptr->left;free(ptr);
b) ptr->left->right=ptr->right->right;ptr->left->right=ptr->right;free(ptr);
c) ptr->left->right=ptr->left->left;ptr->left->right=ptr;free(ptr);
d) ptr->left->right=ptr->left;ptr->left->right=ptr->left;free(ptr);
ans::a

15) Struct node
            {
               int data;
               struct node *left,*right;
            };
  Suppose ptr is a node which is not in the beginning and also not in the end.
  nd is the new node.
Here is the coding:
 i)  nd->right->left=nd;
 ii)  nd->left=ptr;
 iii)  nd->left->right=nd;
 iv)  nd->right=ptr->right;

Then what sequence does it follows for inserting nd after ptr?



a) i,ii,iii,iv
b) ii,iv,i,iii
c)iv,iii,ii,i
d) ii,iii,i,iv
ans::b



16) In the Given Infix expression which is the root node for ur expression tree
         (A+B)-(C*D)+G/H*I


a) +
b) -
c) *
d) /
ans::a


17) Consider a binary search tree
   insert(10,root);
   insert(25,root);
   insert(5,root);
   insert(8,root);
   insert(13,root);
   insert(45,root);
   insert(70,root);
   insert(32,root);
   delete(13,root);
   insert(66,root);
   insert(13,root);
   insert(36,root);


What will be the preorder traversal is  



a) 5,8,10,13,25,32,36,45,66,70
b) 10,5,8,25,13,45,32,36,70,66
c) 10,8,5,13,32,45,36,66,32,70
d) 8,5,32,36,10,66,45,70,25,13
ans::b              


18) The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is

a) 3,5,7,14,17,22,55                  
b) 14,55,5,7,22,17,3
c) 3,5,14,7,22,17,55
d) 55,22,17,14,7,5,3
ans::a

19) The preorder traversal is 5,3,66,30,77,70 .What will be the root node
a) 5
b) 66
c)70
d)30
ans::5
20) which one of the following is true for the binary tree
   i) root is greater than the left sub tree and lesser than the right sub tree
   ii) root is lesser than the left sub tree and greater than the right sub tree 
ans::i

a) only i
b) only ii
c) both i and ii
d) neither i nor ii

ans::a
1) void main()
    {
            int i=0;
     while(i==0)
       {   }
           
    printf("%d",i);
   }
ans::infinite loop


2)         void main()
    {
            int i=1;
        while(++i==1)
        {  }
        printf("%d",i);
   }
   ans::2

3)         char s[]={'a','b','c','\0'};
            printf("%s",s);
ans::abc

4)         int arr[3][3]={2,3,4,5,6,7,8,9,10};
            for(i=0;i<=2;i++)
            for(j=0;j<=2;++j)
            printf("%d",*(*(arr+i)+j));
ans::2 3 4 5 6 7 8 9 10

5)         int b=20;
            printf("%d",++*&b);
ans::21

6)         which can be replaced by a switch block?
            a) do..while
            b) for
            c) while
            d) else if
ans::d

7)         which of these is not a operator in c?
            a) ~
            b) ^
            c) %
            d) ::
ans::d
8)         which of these is not a valid character constant
            a) "A"
            b) '*'
            c) '+'
            d) 'h'
ans::a
9)         struct student
            {
               int i;
               char c[10];
               struct student *s;
            };
            struct student stud,*stu;
            stu=&stud;
            printf("%d  %d",sizeof(stud));

ans::14
10)       insert(root,2);
            insert(root,1);
            insert(root,3);
            insert(root,4);
            insert(root,5);
            What is the inorder for the above tree?

ans::1 2 3 4 5
11)       insert(root,2);
            insert(root,1);
            insert(root,3);
            insert(root,4);
            insert(root,5);
            What is the preorder for the above tree?
ans::2  1 3 4 5

12)       The prefix expression is ab+c*d/e-.If the values of a,b,c,d,e are 5,2,3,3,1
            respectively,then what will be the output?

13)       What is the order in which the preorder is evaluated?          
                        i) root node
                        ii) left node
                        iii) right node

            a) i,ii,iii
            b) ii,iii,i
            c) iii,ii,i
            d) ii,i,iii


14)       which operations are more effective in linked list than arrays?
            i) insertion
            ii) deletion
            iii) traversal

                        a)i,ii only
                        b)iii only
                        c) all the above
                        d) i,iii only

15)       what is the output of the following program?

            void main()
            {
            int i=12;
            int *q;
            q=&i;
            *q=*q-8;
            printf("%d",i);
            }

16)       what is the use of precedence in C programs for operators?
            a) Precendence are used to replace the variables used in operations
            b) precendence are used to allocate memory space
            c) precendence are used to evaluate the expression first
            d) None of the above



17)       aaa(){ printf("Hai")};
            bbb(){ printf("Hello")};
            ccc(){ printf("Bye")};
            void main()
            {
               int (*ptr[3])();
               ptr[0]=aaa;
               ptr[1]=bbb;
               ptr[2]=ccc;
            }


18)       In Unsigned char,signed value is represented by 1 in most significant bit.   
                        a) true
                        b) false

19)       int i=1;
            switch(i*2)
            {
              case 1:
                        printf("case1");
                        break;
              case 2:
                        printf("case 2");
              default:         
                        printf("default");
                    break;
            }
            a) case1 case2 default
            b) case2
            c) case2 default
            d) compiler error

20)       struct node
            {
               int info;
               struct node *left,*right;
            };
            if nd is a pointer which is pointing to the first node,then which one of the
            following is correct?
                        a) nd->right = NULL;
                        b) nd->left = NULL;
                        c) nd = NuLL;
                        d) nd->left->right = NULL;



21)       struct a
            {
              char *i;
              char *j;
            };
            struct b
            {
              struct a x;
              int i;
            }*y;
            printf("%d %d",sizeof(y),sizeof(*y));


22)       #define t printf
            void main()
            {
            int i=10;
            t("%d",i);
            } 
                                                           
           
23)       int a[3][4]={1,2,3,4,5};
            printf("%d",a[0][4]);


24)       which one is used to check the given string is palindrome or not
            a) Single Linked list
            b) doubly linked list
            c) Arrays
            D) none of the above


25)       #define HELLO hai
            void main()
            {
              printf("HELLO");
            }

26)       The formal arguments has a default value zero
            a) true
            b) false

27)       void fun()
            {
              ?????
              x++;
              printf("%d",x);
            }
            int x;
            void main()
            {
              x=7;
              printf("%d",x);
               x++;
              printf("%d",x);
            fun();
            }
            if the outputs are 7,8,9,then which is replaced instead of ?????
                        a) extern int x;
                        b) auto int x;
                        c) static int x;
                        d) register int x;


28)       if rear=-1,front=-1 then what will be my queue?
                        a) Queue is empty
                        b) Queue is full
                        c) Queue has one element
                        D) Queue has max-1 element

29)       void main()
            {
               int i;
                for(i=1;i<=5;i++)
                        {}
                 printf("%d",i);
             }


30)       If p=(int *) malloc(sizeof(int)*10),then which one is true?
                        i) It allocates 20 bytes of memory
                        ii) The value in the memory is allocated to zero
            a) i only
            b)ii only
            c) both i and ii
            d) neither i nor ii

31)       If p=(int *) calloc(sizeof(int)*10),then which one is true?
                        i) It allocates 20 bytes of memory
                        ii) The value in the memory is allocated to zero
            a) i only
            b)ii only
            c) both i and ii
            d) neither i nor ii


32) Predict the output
           
            int i=1;
            while(i<3)
            {
                        switch(i)
                        {
                                    case 1:
                                                printf ("Case 1");
                                                break;
                                    case 2:
                                                printf ("case 2");
                                                break;
                                    default:
                                                printf ("Default");
                        }
                        i++:
            }

33) If rear=0 front=0 what is queue?

34) if rear=max, front=0, what is queue?

35) for (i=1; i=2; i++)
            {
                        printf ("HAI");
            }


36)       Consider a linked list where ptr is a pointer which is not pointing to the
            first node and not to the last node.If there is another node called "new" which
            is like new->next=NULL,then what is the scenario?
                        a) It is the first node
                        b) It is the last node
                        c) It is in the middle
                        d) none of these


37)       If 'a' is the integer which is not statically initialized then what is the value of 'a'?
                        a) zero
                        b) garbage
                        c) none of these

38)       struct emp
            {
                int a=20;
                char name[10]="AAA";
            };
            void main()
            {
               struct emp oemp;
               printf("%s",oemp->name);
               printf("%d",oemp->a);
            }


39)       Which of the following is considered as tokens in C?
                        a) Variables
                        b) Keywords
                        c) Constants
                        d) All the above


40)       C is a ____________________ language
                        a) Platform independent programming
                        b)  Platform dependent programming
                        c) Object oriented programming
                        d) None of the above

41)       main()
            {
               int i=3;
                switch(i);
                {
                        default: printf("default");
                        case 1: printf("case 1");
                        case 2: printf("case 2");          
                                    break;
                }
           
42)       #define FIRST 1
            #define SECOND FIRST+FIRST    
            main()
            {
              printf("%d",SECOND * SECOND);
            }

43)       int b[5];
            main()
            {
               static int a[5];
                int i;
            for(i=0;i<5;i++)
            printf("%d %d",a[i],b[i]);
            }

44)       which is having the more precendence
            a) * b)+ c)== d) -


45)     main()
            {
              char *x="girl";
              int n;
               n=strlen(x);
              *x=x[n];
              for(i=0;i<n;i++)
            {
               printf("%s \n",x);
                x++;
            }
            }


46)       int sample(int x)
            {
               int *y;
                y=&x;
               x=*y+2;
               return(x);     
            }
            void main()
            {
               int x=5;
                printf("%d",sample(x));
            }




47)       void main()
            {
              int *j,*k;
               int a=5,b=8;
              j=&a;
              k=&b;
              j=j*2;
               k=j/2;
               printf("%d %d",*j,*k);
            }         

           

48)       To make a pointer 'cursor'as a tail node,which line is correct
                        a) cursor->right==NULL
                        b) cursor->left==NULL
                        c) cursor==NULL
                        d) cursor->left==0


49)       Single linked list has a lnk to the next address
                        a) true
                        b) false


50)       int 5[x]={1,2,3,4,5};
            printf("%d",2[x]);
            error

51)       int arr[]={1,2,3,4,5};
            printf("%d %d",arr,&arr);


52)       int a[3][4]={1,2,3,4,5,6,7,8,9,0};
            printf("%d %d",a,a[2][1]);

53)       The argc,argv are initialised in
                        a) header file
                        b) within main
                        c) outside main
                        d) none
              ans::


54)       Queue is
                        i) First in first out
                        ii) used in expression evaluation.
            a) i only
            b) ii only
            c) both i and ii
            d) neither i nor ii

55)       which is correct?
            a) Auto variables are local variables
            b) Extern variables are global variables
            c) static variables are global variables
            d) registers are local variables

56)       main()
            {
              int i=5;
              int *p;
              p=&5;
              printf("%d %d",i,*p);
            }         


57)       int foo(int a,float b)
            {
               float c;
               c=(float)a+b;
            printf("%c",c);
            }
            main()
            {
              ?????
              foo(8,12.5);
            }
            which line is replaced for ?????? to get the ouput of 20.5


58)       main()
            {
               float v;
               v=10/4.0;
              printf("%f",v);
            }
            ans::2.500000


59)       In a doubly linked list, p1 and p2 are the 2 nodes and node nd is inserted as
               nd->next=NULL
               nd->prev=p1->next



60)     void main()
            {
               int i=12,j,*p;
               p=&i;
               j=++*p+8;
               printf("%d",j);
            }
ans::21

1) void main()
    {
            int i=0;
    while(i==0)
      {    }
           
    printf("%d",i);
   }
output::infinet loop


2)         void main()
        {
            int i=1;
        while(++i==1)
         { }
           
    printf("%d",i);
   }


3)         char s[]={'a','b','c','\0'};
            printf("%s",s);


4)         int arr[3][3]={2,3,4,5,6,7,8,9,10};
            for(i=0;i<=2;i++)
            for(j=0;j<=2;++j)
            printf("%d",*(*(arr+i)+j));


5)         int b=20;
            printf("%d",++*&b);


6)         which can be replaced by a switch block?
            a) do..while
            b) for
            c) while
            d) else if


7)         which of these is not a operator in c?
            a) ~
            b) ^
            c) %
            d) ::

8)         which of these is not a valid character constant
            a) "A"
            b) '*'
            c) '+'
            d) 'h'

9)         struct student
            {
               int i;
               char c[10];
               struct student *s;
            };
            struct student stud,*stu;
            stu=&stud;
            printf("%d  %d",sizeof(stud));


10)       insert(root,2);
            insert(root,1);
            insert(root,3);
            insert(root,4);
            insert(root,5);
            What is the inorder for the above tree?


11)       insert(root,2);
            insert(root,1);
            insert(root,3);
            insert(root,4);
            insert(root,5);
            What is the preorder for the above tree?


12)       The prefix expression is ab+c*d/e-.If the values of a,b,c,d,e are 5,2,3,3,1
            respectively,then what will be the output?

13)       What is the order in which the preorder is evaluated?          
                        i) root node
                        ii) left node
                        iii) right node

            a) i,ii,iii
            b) ii,iii,i
            c) iii,ii,i
            d) ii,i,iii


14)       which operations are more effective in linked list than arrays?
            i) insertion
            ii) deletion
            iii) traversal

                        a)i,ii only
                        b)iii only
                        c) all the above
                        d) i,iii only

15)       what is the output of the following program?

            void main()
            {
            int i=12;
            int *q;
            q=&i;
            *q=*q-8;
            printf("%d",i);
            }

16)       what is the use of precedence in C programs for operators?
            a) Precendence are used to replace the variables used in operations
            b) precendence are used to allocate memory space
            c) precendence are used to evaluate the expression first
            d) None of the above



17)       aaa(){ printf("Hai")};
            bbb(){ printf("Hello")};
            ccc(){ printf("Bye")};
            void main()
            {
               int (*ptr[3])();
               ptr[0]=aaa;
               ptr[1]=bbb;
               ptr[2]=ccc;
            }


18)       In Unsigned char,signed value is represented by 1 in most significant bit.   
                        a) true
                        b) false

19)       int i=1;
            switch(i*2)
            {
              case 1:
                        printf("case1");
                        break;
              case 2:
                        printf("case 2");
              default:         
                        printf("default");
                    break;
            }
            a) case1 case2 default
            b) case2
            c) case2 default
            d) compiler error

20)       struct node
            {
               int info;
               struct node *left,*right;
            };
            if nd is a pointer which is pointing to the first node,then which one of the
            following is correct?
                        a) nd->right = NULL;
                        b) nd->left = NULL;
                        c) nd = NuLL;
                        d) nd->left->right = NULL;



21)       struct a
            {
              char *i;
              char *j;
            };
            struct b
            {
              struct a x;
              int i;
            }*y;
            printf("%d %d",sizeof(y),sizeof(*y));


22)       #define t printf
            void main()
            {
            int i=10;
            t("%d",i);
            } 
                                                           
           
23)       int a[3][4]={1,2,3,4,5};
            printf("%d",a[0][4]);


24)       which one is used to check the given string is palindrome or not
            a) Single Linked list
            b) doubly linked list
            c) Arrays
            D) none of the above


25)       #define HELLO hai
            void main()
            {
              printf("HELLO");
            }

26)       The formal arguments has a default value zero
            a) true
            b) false

27)       void fun()
            {
              ?????
              x++;
              printf("%d",x);
            }
            int x;
            void main()
            {
              x=7;
              printf("%d",x);
               x++;
              printf("%d",x);
            fun();
            }
            if the outputs are 7,8,9,then which is replaced instead of ?????
                        a) extern int x;
                        b) auto int x;
                        c) static int x;
                        d) register int x;


28)       if rear=-1,front=-1 then what will be my queue?
                        a) Queue is empty
                        b) Queue is full
                        c) Queue has one element
                        D) Queue has max-1 element

29)       void main()
            {
               int i;
                for(i=1;i<=5;i++)
                        {}
                 printf("%d",i);
             }


30)       If p=(int *) malloc(sizeof(int)*10),then which one is true?
                        i) It allocates 20 bytes of memory
                        ii) The value in the memory is allocated to zero
            a) i only
            b)ii only
            c) both i and ii
            d) neither i nor ii

31)       If p=(int *) calloc(sizeof(int)*10),then which one is true?
                        i) It allocates 20 bytes of memory
                        ii) The value in the memory is allocated to zero
            a) i only
            b)ii only
            c) both i and ii
            d) neither i nor ii


32) Predict the output
           
            int i=1;
            while(i<3)
            {
                        switch(i)
                        {
                                    case 1:
                                                printf ("Case 1");
                                                break;
                                    case 2:
                                                printf ("case 2");
                                                break;
                                    default:
                                                printf ("Default");
                        }
                        i++:
            }

33) If rear=0 front=0 what is queue?

34) if rear=max, front=0, what is queue?

35) for (i=1; i=2; i++)
            {
                        printf ("HAI");
            }


36)       Consider a linked list where ptr is a pointer which is not pointing to the
            first node and not to the last node.If there is another node called "new" which
            is like new->next=NULL,then what is the scenario?
                        a) It is the first node
                        b) It is the last node
                        c) It is in the middle
                        d) none of these


37)       If 'a' is the integer which is not statically initialized then what is the value of 'a'?
                        a) zero
                        b) garbage
                        c) none of these

38)       struct emp
            {
                int a=20;
                char name[10]="AAA";
            };
            void main()
            {
               struct emp oemp;
               printf("%s",oemp->name);
               printf("%d",oemp->a);
            }


39)       Which of the following is considered as tokens in C?
                        a) Variables
                        b) Keywords
                        c) Constants
                        d) All the above


40)       C is a ____________________ language
                        a) Platform independent programming
                        b)  Platform dependent programming
                        c) Object oriented programming
                        d) None of the above

41)       main()
            {
               int i=3;
                switch(i);
                {
                        default: printf("default");
                        case 1: printf("case 1");
                        case 2: printf("case 2");          
                                    break;
                }
           
42)       #define FIRST 1
            #define SECOND FIRST+FIRST    
            main()
            {
              printf("%d",SECOND * SECOND);
            }

43)       int b[5];
            main()
            {
               static int a[5];
                int i;
            for(i=0;i<5;i++)
            printf("%d %d",a[i],b[i]);
            }

44)       which is having the more precendence
            a) * b)+ c)== d) -


45)     main()
            {
              char *x="girl";
              int n;
               n=strlen(x);
              *x=x[n];
              for(i=0;i<n;i++)
            {
               printf("%s \n",x);
                x++;
            }
            }


46)       int sample(int x)
            {
               int *y;
                y=&x;
               x=*y+2;
               return(x);     
            }
            void main()
            {
               int x=5;
                printf("%d",sample(x));
            }

4 comments:

  1. koi isse padhke more than 70%laya v hai kya ? boleto q yehi Ata hai ?

    ReplyDelete
  2. Anonymous5:15 AM

    Hai I have noted every thing from this.... but a doubt whether now also wipro infotech follow this questions or pattern....

    ReplyDelete
  3. Brilliant blog I visit this blog it's incredibly awesome. Curiously, in this blog content formed doubtlessly and sensible. The substance of information is helpful.
    Oracle Fusion HCM Online Training
    Oracle Fusion SCM Online Training
    Oracle Fusion Financials Online Training

    ReplyDelete