logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • Can you suggest any other way of writing the following expression such that 30 is used only once? a <= 20 ? b = 30 : c = 30 ;


  • Correct Answer
  • *( ( a <= 20 ) ? &b : &c ) = 30; 


  • Programming problems


    Search Results


    • 1. The output of the code below is #include void main() { int i = 0, k; if ( i == 0 ) goto label; for ( k = 0;k < 3; k++ ) { printf( "hin" ); label: k = printf( "%03d", i ); } }

    • Options
    • A. 0
    • B. hi hi hi 0 0 0
    • C. 0 hi hi hi 0 0 0
    • D. 0 0 0
    • Discuss
    • 2. Write a c program to find out sum of diagonal element of a matrix.
    • Discuss
    • 3. C program to find whether a number is palindrome or not.
    • Discuss
    • 4. What will output when you compile and run the following code? #include struct student { int roll; int cgpa; int sgpa[8]; }; void main() { struct student s = { 12,8,7,2,5,9 }; int *ptr; ptr = (int *)&s; clrscr(); printf( "%d", *(ptr+3) ); getch(); }

    • Options
    • A. 8
    • B. 7
    • C. 2
    • D. Compiler error
    • Discuss
    • 5. What will be output of following program ? #include int main() { int a = 10; void *p = &a; int *ptr = p; printf("%u",*ptr); return 0; }

    • Options
    • A. 10
    • B. Address
    • C. 2
    • D. Compilation error
    • Discuss
    • 6. 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 ); }
    • Discuss
    • 7. We want to round off x, a Float to an Int value. The correct way to do so would be

    • Options
    • A. Y = ( int ) ( x + 0.5 ) ;
    • B. Y = int ( x + 0.5) ;
    • C. Y = ( int ) x + 0.5;
    • D. Y = ( int ) ( ( int ) x + 0.5 )
    • Discuss
    • 8. What would be the output of the following program? # define SQR(x) (x * x) main() { int a, b = 3; a = SQR ( b + 2 ); Printf ("\n %d ", a ); }
    • Discuss
    • 9. What is Autosys?
    • Discuss
    • 10. Two main measures for the efficiency of an algorithm are

    • Options
    • A. Time and Space
    • B. Complexity and Memory
    • C. Data and Space
    • D. Memory and Processor
    • Discuss


    Comments

    There are no comments.

Enter a new Comment