Searching for "program."

Q:

Replace each letter for a unique digit so that the equation is correct

Answer

(1+9+6+8+3) x (1+9+6+8+3) x (1+9+6+8+3) = 19683

Report Error

View answer Workspace Report Error Discuss

Subject: Math Puzzles Exam Prep: Bank Exams , AIEEE
Job Role: Bank Clerk

Q:

Study the given bar graph and pie chart to answer the following questions.

The bar graph shows the production (in thousand tonnes) of Wheat, Rice and Maize in different states.

The pie-chart shows the percentage of agricultural land in the given six states.

Productivity = 

1.The productivity of which state is the maximum ?

1. Bihar       2. Haryana     3. Punjab     4. UP       5. MP

 

2.The production of which state is the maximum ?

1. Bihar       2. MP         3. Haryana       4. UP       5. Punjab

 

3.The prodution of wheat in punjab is what per cent more than the production of Maize in odisha ?

1. 350%       2. 250%       3. 300%       4. 200%       5. 400%

 

4.What is the ratio of the production of Rice in Bihar to the production of Wheat in Haryana ?

1. 2:3           2. 3:2           3. 2:1           4. 1:1             5. 1:2

 

5.If MP exports 40% of Rice at the rate of Rs.30 per kg and UP exports 30% of Rice at the rate of Rs.32 per kg, then what is the ratio of the income from the exports ?

1. 65:48       2. 31:42       3. 43:54       4. 57:62       5. 1:2

Answer

1. Answer : 2


Explanation : Productivity = Total production/area of Agr.land 


Productivity of UP = [ (35000+30000+25000) / (30/100) ] = 300000  


Productivity of MP = [ (30000+37500+27500) / (25/100) ] = 380000  


Productivity of Bihar = [ (22500+27500+25000) / (20/100) ] = 375000 


Productivity of Odisha = [ (22500+15000+10000) / (5/100) ]= 950000  


Productivity of Haryana = [ (30000+25000+35000) / (8/100) ] = 1125000  


Productivity of Punjab = [ (40000+35000+30000) / (12/100) ] = 875000 


The Productivity of Haryana is the maximum.  


 


 


2. Answer : 5  


Explanation : Production of Punjab is maximum = 105000 tonnes 


 


 


3. Answer : 3 


Explanation : Production of Wheat in Punjab = 40000 tones


Production of Maize in Odisha = 10000 tones


Required % = (40000 - 10000)/100 = 300% 


 


 


4. Answer : 4 


Explanation : The ratio of prodution of Rice in Bihar to the production of Wheat in Haryana = 25000 tonnes : 25000 tonnes = 1 : 1  


 


 


5. Answer : 1  


Explanation : Income of MP from export of 40% of Rice at the rate of Rs.30 per kg = Rs.39crore


Income of UP from export of 30% of Rice at the rate of Rs.32 per kg = Rs.28.8 crore 


Required ratio = 39 : 28.8 = 390 : 288 = 65 : 48

Report Error

View answer Workspace Report Error Discuss

Subject: Bar Charts Exam Prep: GATE , CAT , Bank Exams , AIEEE
Job Role: Bank PO , Bank Clerk , Analyst

Q:

What do the functions atoi(), itoa() and gcvt () do? Show how would you use them in a program.

Answer

atoi()         Converts a string to an integer.


itoa()         Convert an integer to a string


gcvt()        Converts a floating-point number to a string


 


#include "stdlib.h"


main()


{


      char s[] = "12345";


      char buffer [15], string[20];


      int i;


      


      i = atoi (s);


      printf("\n%d",i);


 


       gcvt (20.141672, 4, buffer);


       printf ("\n%s", buffer);


 


       itoa(15, string,2);


        printf ("\n%s", string);


}

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

Q:

Point out the error, if any, in the following program.

#include "stdarg.h"

main()

{

     display ( 4, 12.5, 13.5, 14.5, 44.3);

}

display(int num, ...)

{

       float c; int j;

        va_list ptr;

        va_start (ptr, num);

        for ( j = 1; j <= num; j++)

        {

            c = va_arg ( ptr, float );

            printf ("\n%f", c);

         }

}

Answer

While extracting a float argument using va_arg we should have useed 


c = va_arg (ptr, double)

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

Q:

Point out the error in the following program.

main()

{

    char mybuf[] = "Zanzibar" ;

    char yourbuf[] = " Zienckewiz";

    char * const ptr = mybuf;

     *ptr = 'a';

     ptr = yourbuf;

}

Answer

ptr pointer is constant. In ptr = yourbuf the program is trying to modify it, hence an error.

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

Q:

Point out the error, if any, in the following program.

# include "stdio.h"

main()

{

     FILE *fp;

     char str[80];

     fp = fopen ("trail", "r");

     while (!feof (fp))

    {

           fgets (str, 80, fp);

           puts (str);

     }

     fclose (fp);

}

Answer

The last line from the file "trial" would be read twice. To avoid this, ues:


       While ( fgets (str, 80, fp) ! = NULL)


               puts (str);

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

Q:

Point out the error, if any, in the following program.

#include "stdio.h"

main()

{

      unsigned char;

       FILE *fp;

       fp = fopen ("trail", "r");

       while (( ch = getc (fp)) ! = EOF)

               printf ("%c", ch);

       fclose (fp);

}  

Answer

EOF has been defined as #define EOF -1 n the file "stdio.h" and an unsigned char ranges from 0 to 255 hence when EOF is read from the file it cannot be accommodated in ch. Solution is to declare ch as an int.

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

Q:

Point out the error, if any, in the following program.

main()

{

    int a = 10;

    void f();

    a = f();

    printf ( "\n %d", a );

}

void f()

{

    printf ( "\n Hi ");

}

Answer

In spite of defining the function f() as returning void, the program is trying to collect the value returned by f() in the variable a.

Report Error

View answer Workspace Report Error Discuss

Subject: Programming