logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • What will be output of the following c program ? #include int main() { int max-val=100; int min-val=10; int avg-val; avg-val =( max-val + min-val ) / 2; printf( "%d", avg-val ); return 0; }


  • Options
  • A. 55
  • B. 105
  • C. 60
  • D. Compilation error

  • Correct Answer
  • Compilation error 

    Explanation

    We cannot use special character ? in the variable name.
    Variable name can have only underscore.


  • Programming problems


    Search Results


    • 1. A function cannot be defined inside another function

    • Options
    • A. TRUE
    • B. FALSE
    • Discuss
    • 2. What will be output when you will execute following c code? #include void main() { int const SIZE = 5; int expr; double value[SIZE] = { 2.0, 4.0, 6.0, 8.0, 10.0 }; expr=1|2|3|4; printf ( "%f", value[expr] ); }

    • Options
    • A. 2.000000
    • B. 4.000000
    • C. 8.000000
    • D. Compilation error
    • Discuss
    • 3. In programming, repeating some statements is usually called ?

    • Options
    • A. Running
    • B. Structure
    • C. Looping
    • D. Control structure
    • Discuss
    • 4. What would be the output of the following program? main() { extern int fun ( float ); int a; a = fun ( 3. 14 ); printf ("%d", a); } int fun ( aa ) float aa ; { return ( (int) aa ); }
    • Discuss
    • 5. What will be output when you will execute following c code? #include void main() { signed int a = -1; unsigned int b = -1u; if(a == b) printf( "The Lord of the Rings" ); else printf( "American Beauty" ); }

    • Options
    • A. The Lord of the Rings
    • B. American Beauty
    • C. Compilation error: Cannot compare signed number with unsigned number
    • D. Warning: Illegal operation
    • Discuss
    • 6. SNOBOL is mainly used for

    • Options
    • A. Text Operation
    • B. String operations
    • C. List operations
    • D. Numerical operations
    • Discuss
    • 7. What is the output of this C code? #include int main() { int a = 1, b = 1; switch (a) { case a*b: printf("yes "); case a-b: printf("non"); break; } }

    • Options
    • A. yes
    • B. no
    • C. Compile time error
    • D. yes no
    • Discuss
    • 8. Which of the following statement is true?

    • Options
    • A. Cohesion is the OO principle most closely associated with hiding implementation details
    • B. Cohesion is the OO principle most closely associated with making sure that classes know about other classes only through their APIs
    • C. Cohesion is the OO principle most closely associated with making sure that a class is designed with a single, well-focused purpose
    • D. None
    • Discuss
    • 9. How many times i value is checked in the below code? #include int main() { int i = 0; do { i++; printf( "In while loopn" ); } while (i < 3); }

    • Options
    • A. 2
    • B. 3
    • C. 4
    • D. 1
    • Discuss
    • 10. void main() { char good *better, *best; printf( "%d..%d", sizeof(better), sizeof(best) ); }

    • Options
    • A. 1..2
    • B. 4..4
    • C. 4..2
    • D. 2..2
    • Discuss


    Comments

    There are no comments.

Enter a new Comment