Programming Questions

Q:

What would be the output of the following program assuming that the array beigns at location 1002?

main()

{

   int a[3][4] = {

                            1 , 2 , 3 , 4

                            5,  6 , 7, 8

                            9, 10 , 11, 12

                       };

    Printf ("\n%u %u %u", a[0] + 1, *( a[0] + 1), *( *(a + 0) + 1) );

}

Answer

1004  2  2

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

1 1846
Q:

Write a c program to print multiplication table

Answer

 #include<stdio.h>
int main(){
  int r,i,j,k;
  printf("Enter the number range: ");
  scanf("%d",&r);
  for(i=1;i<=r;i++){
      for(j=1;j<=10;j++)
           printf("%d*%d=%d ",i,j,i*j);
      printf("\n");
  }
  return 0;
}

Sample Output:
Enter the number range: 5

1*1=1 1*2=2 1*3=3 1*4=4 1*5=5 1*6=6 1*7=7 1*8=8 1*9=9 1*10=10
2*1=2 2*2=4 2*3=6 2*4=8 2*5=10 2*6=12 2*7=14 2*8=16 2*9=18 2*10=20
3*1=3 3*2=6 3*3=9 3*4=12 3*5=15 3*6=18 3*7=21 3*8=24 3*9=27 3*10=30
4*1=4 4*2=8 4*3=12 4*4=16 4*5=20 4*6=24 4*7=28 4*8=32 4*9=36 4*10=40
5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 5*6=30 5*7=35 5*8=40 5*9=45 5*10=50

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 1828
Q:

Will the following function work?

f1 ( int a, int b )

{

    return ( f2 (20) );

}

f2 ( int a )

{

    return ( a * a );

}

Answer

Yes

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 1814
Q:

What would be the output of the following program?

main()

{

  extern int i;

   i = 20;

  printf( "%d", sizeof(i) );

}

Answer

extern int i is a declaration and not a definition, hence Error occured.

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 1794
Q:

What would be the output of the following program?

main()

{

    printf (" %d%d%d ", sizeof (3.14f), sizeof (3.14), sizeof (3. 141);

}

Answer

4  8  10

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 1775
Q:

What would be the output of the following program?

main()

{

    char a[] = "Visual C++";

    char *b = "Visual C++";

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

    printf ("\n%d %d", sizeof (*a), sizeof (*b));

Answer

11  2


 1   1

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

1 1771
Q:

What would be the output of the following program?

main()

{

    int i = -3, j =2, k =0, m ;

    m = ++j && ++i || ++k ;

    Printf ( "\n%d%d%d%d", i , j , k , m );

}

Answer

-2  3  0  1

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

1 1766
Q:

SNOBOL is mainly used for

A) Text Operation B) String operations
C) List operations D) Numerical operations
 
Answer & Explanation Answer: B) String operations

Explanation:

SNOBOL is a high-level computer programming language used especially in manipulating textual data. It is mainly used for string operations and was developed between 1962 and 1967.

Report Error

View Answer Report Error Discuss

7 1765