Technical Aptitude Questions: Sample C Questions - III

Leave a Comment

31. What will be the output  of the following program :
            void main()
            {
          printf(NULL);
            }
 (a)Run-Time Error      (b)Compile-Time Error                        (c)No Output              (d)None of these

32. What will be the output of the following program :
            void main()
            {
          printf("%d",printf("")+printf(""));
            }
(a)0                              (b)No Output              (c)Compile-Time Error                        (d)None of these

What will be the output of the following program(32-41)(assume all required header files are included)
33. #define pxx(a,v) printf("\nval=%d",a##v)
  main()
 {
            int x1=12,x2=24,x3=35;
            pxx(x,1);
            pxx(x,2);
            pxx(x,2+3);
            getch();
}
a) val=12 val=24 val=27         b)error    c)val=12 val=24 val=35       d)val=12 val=12 val=17   
34. main()
{
            int a,b;
            float f;
            scanf("%2d%3d%4f",&a,&b,&f);
            printf("%d %d %f",a,b,f);
            getch();
}
WHAT WILL BE THE OUTPUT IF THE INPUT FOR SCANF STATEMENT IS 123456 ??
a)12  345 6.000000     b)123456         c)some value between -32768 and 32767   d) 123 456
35. main()
{
            printf("%d",2<<2>>2);
            printf("\n%d",2>>2<<(1<<1));
            getch();
}
a)0  2               b)2  0               c)0  0               d)0  1

36. main()
{
            printf("ACM-CIC"+4);
            printf(4+"\nACM-CIC");
            getch();
}
a)CICCIC       b)-CICM-CIC             C)CIC-CIC     d)CICM-CIC

37. main()
{
            int i=10;
            printf("%d %d",i+++i,i---i);
            printf("\n%d",i);
            getch();
}    

a)18  0             b)21  1             c)19  1             d)19     0         
   10                   10                    10                  10
          
38. main()
{
            int a;
            a = (1,45,012)>=12?100:200;
            printf("%d\t",a);
            a = 1,2,24<=12?100:200;
            printf("%d\t",a);
            a = (1,2,30);
            printf("%d\t",a);
            getch();
}
a)200  1   30               b)100  100  1               c)100  1  30                 d)200   200   30  
39. main()
{
            int I = -3, j=2, k = 0,m;
            m = ++I && ++j || ++k;
            printf("\n%d %d %d %d", I, j, k, m);
            getch();   }
a)error message           b)-2 3 0 1                     c)-2  3 1  1                   d)-2  2 0 1
40.main()
    {      int a=10,b=20;
            a=a^b;
            b=b^a;
            a=a^b;
            printf("a= %d b=%d ",a,b);getch();
  }
a)a=20   b=10              b)a=10  b=20               c)a=1   b=1      d)a=1   b=20
41. main()
{
            int i =2,j;
            j = add(++i);
            printf("i = %d j = %d\n", i, j);
           
            getch();
}
int add(int ii)
{
            ii++;
            printf("ii = %d\n", ii);
}
a)ii=3                  b)ii=4                        c)ii=4                  d)ii=4
i=2  j=4               i=3 j=7                      i=3  j=4                3   45873*        
*  some garbage value

42.  The mechanism that bring a page into memory only when it is needed is called _____________ 
1 Segmentation 
2 Fragmentation 
3 Demand Paging 
4 Page Replacement 
43. 20) Which technique was introduced because a single job could not keep both the CPU and the I/O devices busy? 
1 Time-sharing 
2 SPOOLing 
3 Preemptive scheduling 
4 Multiprogramming 
44.  Which of the following file name extension suggests that the file is Backup copy of another file ? 
1 TXT 
2 COM 
3 BAS 
4 BAK 
45) 7) The number of processes completed per unit time is known as __________. 
1 Output 
2 Throughput 
3 Efficiency 
4 Capacity 
46)The solution to Critical Section Problem is : Mutual Exclusion, Progress and Bounded Waiting. 
1 The statement is false 
2 The statement is true. 
3 The statement is contradictory. 
4 None of the above 
47) A page fault occurs 
1 when the page is not in the memory 
2 when the page is in the memory 
3 when the process enters the blocked state 
4 when the process is in the ready state 

48)what is a TUPLE?
a)an attribute attached to record         b)another name for the key linking different tables in a database
c)a row or record in a database table  d)another name for table in a rdms
49) What is a shell ? 
1 It is a hardware component 
2 It is a command interpreter 
3 It is a part in compiler 
4 It is a tool in CPU scheduling 
50) A relationship between the instances of a single entity type is called a(n) _____ relationship.
a)binary           b)tertiary         c)primary         d)ternary         e)unary

0 comments:

Post a Comment