Sample Questions for CDAC Entrance exam (C-CAT)


 APTITUDE

1. A little ball is dropped from a height of 8 ft. & it bounces back each time to height which is one half of height of last bounce. How far will ball have traveled when it comes to rest?
a) 20                            b) 24
c) 30                            d) None

2. Next three terms

1+3+7+15+31+63…..

3.A train is traveling at speed of 96km/hr. It takes 3 seconds to enter a tunnel and 30 seconds more to pass through it completely. What is the length of train and tunnel?
a) 80,750                                             b) 75,800
c) 80,800                                             d) none

4. Calculate equivalent discount of 2 successive discounts of 20% and 10%
a) 28%                                                 b)32%
c) 200%                                               d)None

5. Richa drives 8 km to south turns left and drives 5 km. Again she turns left and drives 8 km. How far is she from starting point?

a) 3 km                                                b) 5 km
c) 8 km                                                d) 13 km

6. A frog starts climbing 30 ft wall. Each hour he climbs 3 ft. and slips back 2.How many days does it take him to reach top and get out?

a) 27 hrs                                              b) 28 hrs
c) 26 hrs                                              d) 30 hrs

7. We have 2 dice one red and one black. In how many different ways can they be thrown?
a) 6                                                      b) 2
c) 36                                                    d) None

8. Pipe s can fill cistern in 2 hrs and pipe k can fill in 3 hrs. Pipe y can empty it in 5 hrs. Suppose all pipes are turned on when cistern is completely empty. How long will it take to fill?                                                     

a) 19/30 hrs                                         b) 30/19 hrs
c) 10 hrs                                              d) None

9. I travel in north direction & then turned left. After traveling for sometime I turn left, again left & then right. Later in journey I turn left & left once again. What is direction I am facing?
a) North                                               b) South
c) East                                                  d) West

10 Pedagogue: learning

a) Student: teacher                               b) lesson: learning
c) professor: erudition                         d) coaching: books



                                                            C LANGUAGE


11 .What would be the output of the following program
.
#include<stdio.h>
main()
{
extern int a;
printf("%d",a);;
}
int a=20;
(a) 20 (b) 0 (c) garbage value (d) error!!


12  .What would be the output of the following program.
main()
{
int a[5]={2,3};
printf("\n %d %d %d",a[2],a[3],a[4]);
}
(a) garbage value (b) 2 3 3 (c) 3 2 2 (d) 0 0 0

13 .What would be the output of the following program.
main()
{
inti=-3,j=2,k=0,m;
m=++i&&++j||++k;
printf("\n %d %d %d %d",i,j,k,m);
}
(a) -2 3 0 1 (b) -3 2 0 1 (c) -2 3 1 1 (d) error


14.What would be the output of the following program.
main()
{
int a,b;
a=sumdig(123);
b=sumdig(123);
printf("%d %d",a,b);
}
sumdig(int n)
{
static int s=0;
int d;
if(n!=0)
{
d=n%10;
n=(n-d)/10;
s=s+d;
sumdig(n);
}
else return(s);
}
(a) 12 6 (b) 6 12 (c) 3 15 (d) error


15.What would be the output of the following program.
#define CUBE(x) (x*x*x)
main()
{
int a,b=3;
a=CUBE(b++);
printf("\n %d %d",a,b);
}
(a) 64 4 (b) 27 4 (c) 27 6 (d) 64 6
.
16  What would be the output of the following program.
main()
{
const int x=get();
printf("%d",x);
}
get()
{
return(20);
}
(a) 20 (b) garbage value (c) error (d) 0


17..A function has this prototype void f1(int **x),
How will you call this function?
(a) int **a;    (b) int a;     ( c) int *a;        (d) int a=5;
       f1(a);         f1(&a);         f1(&a);          f1(&&a);

18 .pointout the error, if any, in the for loop
main()
{
int l=1;
for(;;)
{
printf("%d",l++);
if(l>10)
break;
}
}
(a) The condition in the for loop is a must
(b) The two semicolons should be dropped
(c) The for loop should be replaced by awhile loop
(d) No error

19 Can the following piece of code be executed?
int main(void)
{
char strA[10]="compile",strB[10];
my_strcpy(strB,strA);
puts(strB);
}
char * my_strcpy(char *destination,char *source)
{
char *p=destination;
while(*source!='\0')
{
*p++=*source++;
}
*p='\0';
return destination;
}
(a) Compilation will only give a warning but will proceed to execute & will display "compile"
(b) The compilation error char *(char *,char *) differs in levels of indirection from 'int()' will occur
(c) Yes & it will print compile on the screen
(d) None of the above


20. What would be the output of the following program.
#include<stdio.h>
main()
{
char str[5]="fast";
static char *ptr_to_array = str;
printf("%s",ptr_to_array);
}
(a) Compilation will only give a warning but will proceed to execute & will display "fast"
(b) display "fast" on screen
(c) will give a compilation error
(d) none of the above

21.What would be the output of the following program.
main()
{
int num,*p;
num=5;
p=&num;
printf("%d",*p);
}
(a) 6 (b) 5 (c) junk value (d) compilation error

22. What would be the output of the following program.
main()
{
int a[3]={2,3,4};
char *p;
p=a;
p=(char *)((int *)p+1);
printf("%d",p);
}
(a) 2 (b) 0 (c) junk value (d) 3


23.What would be the output of the following program.
main()
{
int i=10;
fn(i);
printf("%d",i);
}
fn(int i)
{
return ++i;
}
(a) 10 (b) 11 (c) 12 (d) Compilation error

24. What will be the value of i & j after the loop is
executed?<BR> for(i=0,j=0;i<5,j<25;i++,j++)
(a) i=4,j= 24 (b) i=24,j= 24 (c) i=25,j= 25 (d) i=5,j=25

25 What would be the output of the following program.
main()
{
int i,j;
i=10;
j=sizeof(++i);
printf("%d",i);
}
(a) 11 (b) 10 (c) 4 (d) compilation error

26 What would be the output of the following program.
main()
{
int i=7;
printf("%d\n",i++*i++);
}
(a) 49 (b) 56 (c) 72 (d) compilation error

27. What will the printf print?
main()
{
char *p,*f();
p=f();
printf("f() returns:%s\n",p);
}
char *f()
{
char result[80];
strcpy(result,"anything will do");
return (result);
}
(a) f() returns: anything will do (b) f() returns:
(c) compilation error (d) The printf statement is not going to be executed

28.How many times the following program would print 'Jamboree'?
main()
{
printf("\n Jamboree");
main();
}
(a) infinite number of times (b) 32767 times
(c) 65535 times (d) till the stack does not overflow

29 Notice the error in the default statement in the code snippet below.Will it give a compilation error?
main()
{
int a=10,j;
j=fn(a);
switch(j)
{
case 30: printf("the value is 30");
break;
case 50: printf("the value is 50");
break;
default:printf("the value is not 30 or 50");
}
}
fn(int a)
{
return (++a);
}
(a) Will display "the value is 30"
(b) Will display "The value is not 30 or 50"
(c) Yes a compilation error would happen
(d) No compilation errors but there will be no output on the screen

30.What would be the output of the following program.
main()
{
struct emp
{
char name[20];
int age;
float sal;
};
struct emp e = {"tiger"};
printf("\n %d %f",e.age,e.sal);
}
(a) 0 0.000000 (b) Garbage values (c) Error (d) none of the above 

 


31. Given the following statement
     enum day = { jan = 1 ,feb=4, april, may}
     What is the value of may?

(a) 4
(b) 5
(c) 6
(d) 11
(e) None of the above

32. Find the output for the following C program
f=(x>y)?x:y
a)      f points to max of x and y
b)      f points to min of x and y
c)      Error
d)       None of these
                 
                                                                                                                   
33    int i = 0;
main( )
     {    
printf(“in main i =%d\n”, i);   
i ++;
            val( );  
printf(“in main i =%d\n”, i);                                                       
      }
  val( )
      {
       int i = 100;
       printf(“in val i = %d\n”, i);
        i ++;
       }                          
   a) 101  1   b) Error message        c)1  100          d) None
34    define NO
#define YES
    main( )
      {   
int i = 5, j;       
if( i > 5)          
j = YES;          
else     
j = NO;
printf(“%d”, j);
        } 

a)  Yes  Yes  Yes   Yes   Yes   Yes   b) Error Message   c) None           d ) No No No
35    define AND &&
#define OR ||
  #define LE <=
  #define GE >=                                                                                       
   main( )
   {
    char ch = ‘D’;
    if((ch GE 65 AND ch LE 90) OR (ch GE 97 AND ch LE 122))                 
printf(“Alphabet”);     
else                 
printf(“Not an alphabet”);
  }                                                       
a) No Alphabet            b) Alphabet      c) error             d)None

36    main( )
      {   
int n[25];         
 
n[0] = 100;     
n[24] = 200;    
printf(“%d %d”, *n, *(n + 24) + *(n + 0));
       }  
 a) 200    100   b) 100    300   c) 100    200    d) None
37    main( )
{         
int arr[ ] = { 0, 1, 2, 3, 4};|
            int i, *ptr;
            for(ptr = arr + 4; ptr = arr; ptr--)
    printf(“%d”, *ptr);
    }
a)  0 1 2 3 4                 b) 4 3 2 1 0                  c) 1 2 3 4 0                  d)None
38    main( )
  {       
static char str[ ] = { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48};    
char *s;           
int i;    
s = str; 
for(i = 0; i <=9; i++)                                                                            
{         
if(*s)   
 printf(“%c”, *s);        
    s++;
}
    }
a)0 0 0 0 0 0 0 0 0 0   b) 1 1 1 1 1  1 1 1 1  1  c) 48 48 48 48 48 48 48 48 48 48  d) None
39  main( )
{         
static char str[ ] = { 48, 48, 48, 48, 48, 48, 48, 48, 48, 48};    
char *s;           
int i;    
s = str;
            for(i = 0; i <=9; i++)    
{         
if(*s)   
printf(“%c”, *s);                                                                     
s++;
       }
    }
  a)0 0 0 0 0 0 0 0 0 0   b) 1 1 1 1 1  1 1 1 1  1  c) 48 48 48 48 48 48 48 48 48 48  d) None
40 main( )
  { 
struct employee    
{   
char name[25];     
int  age;     
float bs;
     };         
struct employee e; 
e.name = “Hacker”;          
 e.age = 25;           
printf(“%s%d”, e.name, e.age);
     }
a) Hacker25           b) Error message            c) 25 Hacker         d) None


41 main( )
{   
struct s1    
{   
char*str;                                                                                        
int i;          
struct s1*ptr;         
};
static struct s1 a[ ] ={                                            
{“Nagpur”, 1, a + 1},                                            
{“Raipur”,  2, a + 2},                                            
{“Kanpur”, 3, a}                           
  };
              struct s1*p = a;
              int j;
              for (j = 0; j <=2; j++)       
{   
     printf(“%d”,  --a[j].i);  
     printf(“%s\n”, ++a[j].str);          
}
              } 
a)     1        aipur                b) 0      agpur               c) 0      aipur                d) None          
        
0        agpur                   1      aipur                    1      agpur  
        2   anpur                         2     anpur                    2      anpur
42    define NULL 0
      main( )
      {         
struct node            
{               
struct node *previous;                  
int data;                 
struct node *next;             
} ;
         struct no
de *p, *q;    p = malloc(sizeof(struct node));    
q = malloc(sizeof (struct node));   
p->data = 75;        
q->data = 90;        
p->previous = NULL;                                                                   
p->next = q;
      q->previous = p;         
q->next = NULL;  
while(p!=NULL)   
{                           
printf(“%d\n”, p->data);               
p =p->next;           
}
        } 
       a) 90               b) 75                c) 90                d) None
     
43    main( )
   {
struct a      
{   
int i;          
int j;          
};
      struct b
{   
char x;      
char y[3];  
};  
union c     
{   
struct a aa;
struct b bb;
};  
union c u; 
u.aa.i = 512;          
u.aa.j = 512;
      printf(“%d%d”, u.bb.x, u.bb.y[0]);    
printf(“%d%d”, u.bb.y[1], u.bb.y[2]);
   }                        
a)2020                           b) 0022                c) 0202            d) None
44    main( )
  { 
int a = 3, b = 2, c =1, d;     
d = a| b & c;          
printf(“d = %d\n”, d);
  d = a| b & ~ c;     
printf(“d =%d\n”, d);                                                               
  }
  a)    d = 2 b) d = 3            c) d = 1            d) None
         d = 2     d = 3                d = 1

45    main( )
    {
        static char a[]=”Bombay”;
        char *b=”Bombay”;
        printf(“%d %d”,sizeof(a),sizeof(b));
    }
a)   1 6                  b). 1 1                  c). 6 6                       d). None

46    main( )
    {
         int i=3;
         i=i++;
         printf(“%d”,i));
     }
a.   3                     b. 4                     c. undefined                    d. Error


47    what error would the following function give on compilation.
      f (int a,int b)
      {
          int a
          a=20;
          return a;
      }
a.   Missing parantheses in return statement.
b.   The function should be defined as     int f(int a,int b)
c.   Redeclaration of a.
d.   None of the above.

48    main( )
    {
         int b;
         b=f(20);
         printf(”%d”,b);
     }
int f(int a)
{
    a>20?return (10):return (20);
}
a.   20                      b. 10               c. No output                   d. Error


49    define sqr(x) (x*x)                                                                          
     main( )
     {
          int a,b=3;
          a=sqr(b+2);
          printf(“%d”,a);
      }
a.   25              b. 11          c. Error d. Garbage value

50           #define str(x) #x
       #define Xstr(x) str(x)
      #define oper multiply
      main( )
    {
        char *opername=Xstr(oper);
        printf(“%s”,opername);
     }
a.   oper     b. multiply       c. Error d. None

51    if the program (myprog) is run from the command line as myprog 1 2 3 , What would be the output?
main(int argc, char *argv[])
{
   int i;
   for(i=0;i<argc;i++)
   printf("%s",argv[i]);
  }
  a) 1 2 3                                        b) C:\MYPROG.EXE 1 2 3
c) MYP                                          d) None of the above


52    if the following program (myprog) is run from the command line as myprog 1 2 3, What would be the output?
main(int argc, char *argv[])
   {
   int i,j=0;
   for(i=0;i<argc;i++)
   j=j+ atoi(argv[i]);
   printf("%d",j);
  }
a) 1 2 3     b) 6 c) error d) "123"

53    if the following program (myprog) is run from the command line as myprog monday tuesday wednesday thursday,
What would be the output?
main(int argc, char *argv[])
   {
   while(--argc >0)
   printf("%s",*++argv);
  }
   a) myprog monday tuesday wednesday thursday    
         b) monday tuesday wednesday thursday
         c) myprog tuesday thursday
         d) None of the above                                                   


54    what would be the output of the following program?
 main()
  {
   int y=128;
   const int x=y;
   printf("%d",x);
 }
    a) 128                b) Garbage value                  c) Error                d) 0

55    what would be the output of the following program?
  main()
    {
    char near * near *ptr1;
    char near * far *ptr2;
    char near * huge *ptr3;
    printf("%d %d %d",sizeof(ptr1),sizeof(ptr2),sizeof(ptr3));
   }
     a) 1 1 1         b) 1 2 4       c) 2 4 4    d) 4 4 4

56    if the following program (myprog) is run from the command line as myprog friday tuesday sunday,
What would be the output?
main(int argc, char*argv[])
  {
   printf("%c",**++argv);
  }
  a) m     b) f                     c) myprog                       d) friday

57    if the following program (myprog) is run from the command line as myprog friday tuesday sunday,
What would be the output?                                                                                    
 main(int argc, char *argv[])
   {
    printf("%c",*++argv[1]);
     }
    a) r                           b) f                            c) m                         d) y



58    what would be the output?
main(int argc, char *argv[])
   {
  while(sizeofargv)
  printf("%s",argv[--sizeofargv]);
  }
a) myprog friday tuesday sunday b) myprog friday tuesday
c) sunday tuesday friday myprog d) sunday tuesday friday                               




59    Would the following program compile?
main()
  {
   int a=10,*j;
   void *k;
   j=k=&a;
   j++;
   k++;
   printf("\n%u%u",j,k);
}a) Yes           
  b) No, the format is incorrect
 c) No, the arithmetic operation is not permitted on void pointers                     
d) No, the arithmetic operation is not permitted on pointers

60    according to ANSI specifications which is the correct way of declaring main() when it receives command line arguments?
      a) main(int argc, char *argv[])
            b) main(argc,argv) int argc; char *argv[];
            c) main() {int argc; char *argv[];
           d) None of the above


                                                               DIGITAL
61 A divide-by-10 ring counter requires a minimum of
a)      10 flip-flops
b)      5 flip-flops
c)      4 flip-flops
d)      12 flip-flops
62 Moebius Counter is also know as
a)      Johnson counter
b)      Divide by N Counter
c)      Ripple counter
d)      Mod-N Counter
63 DTL family employs
a)      Resistors and transistors
b)      Diode and resistors
c)      Diode and transistor
d)      Diode, Resistors and transistors
64 The invalid state of a NOR Latch occurs when
a)      S=1,R=0
b)      S=0,R=1
c)      S=1, R=1
d)      S=0, R=0
65 Synchronous sequential logic circuit in comparison to asynchronous circuit requires
a)      less hardware
b)      more hardware
c)      none of the above

66 The OR operation can be produced with
a)      Three NAND gates
b)      Two NOR gates
c)      Four NAND gates
d)      Both a) and b)
67 A flip-flop which can have an uncertain output state is
a)      JK
b)      SR
c)      JK
d)      SR
68 Data selectors are basically the same as
a)      Decoders
b)      Encoder
c)      Demultiplexer
d)      Mutiplexer
69 Carry look ahead adder is
a) Fast
b) Requires more h/w
     c) Costly
     d) All of the above
70 The gray code for decimal 3 is
a)      0000
b)      0010
c)      0001
d)      0011

                                                           DATA STRUCTURE



71. Example of Non Linear data structure are -
a)         tree                                                      b)         graph
c)         stack                                                    d)         none of these

72.Postfix expression of the given Infix expression will be –
(a + b * c – (d / e) * f) – g
a)         abc*+d/ef*-g-                                      b)         abc+*de/f*-g-  
c)         abc*+de/f*-g-                                      d)         none of these

73. Comment-
“If each vertex of a graph has the same degree a every other vertex  , that graph is called ”
            a)         regular graph                                        b)         linear graph
            c)         complete graph                                    d)         discrete graph

74. Comment-
“Circuit is a path that begins and ends at he same vertex”
this circuit is also called
            a)         path                                                     b)         cycle
            c)         Euler path                                            d)         Euler cycle

75. What structure are used to implement BFS
a)         stack                                                    b)         queue
c)         graph                                                   d)         tree

76. Time complexity of BFS and DFS are
a)         O(n^2)                                                 b)         O(n^2  - 1)
c)         O(n)                                                     d)         O(n^3)

77. Node  with same parent are called
a)         child                                                    b)         adjacent node
c)         sibling                                                  d)         offspring

78. Level order traversal requires
a)         Stack                                                    b)         queue
c)         Array                                                   d)         link list

79  Internal sorting takes place in
a)         registers                                               b)         hard disk
c)         main memory                                      d)         none of these

80. No of passes in Bubble sorting 
a)         n                                                          b)         n-1
c)         n+1                                                      d)         n*n

81. Which  sorting technique is based on Divide and Conquer  method
a)         bubble sort                                           b)         merge sort
c)         quick sort                                             d)         selection sort

82. No of comparison in quick sort is
a)         O(log n)                                               b)         O(n log n)
c)         O(log n * n)                                         d)         none of these

83. External searching performs in
a)         b trees                                                  b)         b+ tree
c)         binary search                                       d)         none of these

84. Which one of the tree is not balance tree?
a)         AVL tree                                              b)         B tree
c)         Red black tree                                      d)         none of the above

85. To create minimum spanning tree we can use
a)         Prim’s  algorithm                                 b)         Kruskal   algorithm
c)         Dijkastra  algorithm                             d)         none of these
    

                                     NETWORKING AND COMMUNICATION
 
86 Segmentation of a data stream happens at which layer of the OSI model?
a. Physical       b. Data Link     c. Network       d. Transport
87 Bridges are software based where as switches are ______ based. 
a. RISC            b. CISC            cASIC            d. None of the Above 
88Which of the following is/are true about windowing in TCP/IP?
a.       For a window size of 3 the ack4 signal says send the 4th packet.
b.      For a window size of 3 the acknowledgement is always ack3 to notify THAT the 3 packets were received.
c.       For a window size of three, the packets will be sent in three different routes and acknowledgment is expected for each.
d.      None of the above

89. MAC is to Ethernet what ________is to Frame Relay.
a DLCI          b. LCI           c. PVC           d. None of the Above
90. Which of the following is a digital-interface device used to connect a router to a digital circuit like a T1?
a. A channel service unit/digital service unit (CSU/DSU)         b. DTE
c. An Ethernet card                                                                d. None of the above

91.Which is a device used to connect ISDN Basic Rate Interface (BRI) connections to other interfaces, such as EIA/TIA-232 on a router?
a. ISDN power adapter                        b. ISDN terminal adapter                                 
c. RJ-11 cable                            d. None of the Above

92.You are asked to evolve a TCP/IP addressing scheme for your Organization. How many network numbers (subnet number) must you allow when you design the network for your organization? 
a. One subnet for each Host    b. One for each subnet, one for each WAN connection
 c. One for each network card d. One for each WAN connection only
93You have an IP of 156.233.42.56 with a subnet mask of 7 bits. How many hosts and subnets are possible? 
a. 126 subnets and 510 hosts  b. 128 subnets and 512 hosts

c. 510 hosts and 126 subnets   d. 512 hosts and 128 subnets
94. Which of the following protocols does FTP use? 
a. SNMP    b. TCP/IP         c. ICMP           d. UDP

95. ARP (Address Resolution Protocol) is used to:
a.       Resolve a know host name to its corresponding IP address.
b.      Resolve a known IP address to its corresponding MAC address
c.       Resolve a known IP address to its corresponding host name
d.      Resolve a known MAC address to its corresponding IP address.
96  Match the following:
1. Segments    A. Associated with Data Link Layer
      2. Packets       B. Associated with Network Layer
      3. Frames        C. Associated with Transport Layer
    1. 1--->A; 2---->C; 3 --->B
    2. 1--->C; 2---->A; 3 --->B
    3. 1--->C; 2---->B; 3 --->A
    4. 1--->A; 2---->B; 3 --->C

97Which of the following is true of a Switch?
    1. Switches forward packets based on IP address.
    2. Switches forward packets based on MAC address.
    3. Switches forward packets based on IPX address.
    4. Switches forward packets based on Layer3 protocol.
98.Which of the following relate to the MAC layer?
a.       Address Resolution Protocol (ARP)
b.      Relative Address Resolution Protocol (RARP)
c.       Telnet                         
d.      Trace
99 Source-route bridging occurs primarily in _______environments. 
a. Token Ring b. Ethernet       c. Switched Circuit       d. None of the Above
100 The layer can use the trailer of the frame for error detection
(a) physical
(b) Data link
(c) Transport
(d) Presentation

7 comments: