Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • labinash
    New Member
    • Aug 2007
    • 1

    Question

    GIVE ME THE EXPLANATIONOF FOLLOWING QUESTIONS


    void main()
    {
    int i=1;
    float f=2.25;
    scanf("%d a %f",&i,&f);
    printf("%d %.2f",i,f);
    }
    [NOTE : THE USER INPUT IS:5 5.75]
    (a)1 2.25 (b)5 5.75 (c)5 2.25 (d)None of these
    Ans. (c)

    [Q023]. What will be the output of the following program :
    void main()
    {
    char line[80]; // Max. length=80 Chars
    scanf("%[^,]s",line);
    printf("\n%s",l ine);
    }
    [NOTE : THE USER INPUT IS:Dear Friends, What is the output?]
    (a)Compile-Time Error (b)Dear Friends (c)What is the output? (d)None of these
    Ans. (b)

    [Q022]. What will be the output of the following program :
    void main()
    {
    int a=1,b=2,c=3;
    scanf("%d %*d %d",&a,&b,&c) ;
    printf("a=%d b=%d c=%d",a,b,c);
    }
    [NOTE : 3 values entered by the user are:100 200 300]
    (a)1 2 3 (b)100 200 300 (c)100 200 3 (d)100 300 3
    Ans. (d)
  • Meetee
    Recognized Expert Contributor
    • Dec 2006
    • 928

    #2
    Originally posted by labinash
    GIVE ME THE EXPLANATIONOF FOLLOWING QUESTIONS


    void main()
    {
    int i=1;
    float f=2.25;
    scanf("%d a %f",&i,&f);
    printf("%d %.2f",i,f);
    }
    [NOTE : THE USER INPUT IS:5 5.75]
    (a)1 2.25 (b)5 5.75 (c)5 2.25 (d)None of these
    Ans. (c)

    [Q023]. What will be the output of the following program :
    void main()
    {
    char line[80]; // Max. length=80 Chars
    scanf("%[^,]s",line);
    printf("\n%s",l ine);
    }
    [NOTE : THE USER INPUT IS:Dear Friends, What is the output?]
    (a)Compile-Time Error (b)Dear Friends (c)What is the output? (d)None of these
    Ans. (b)

    [Q022]. What will be the output of the following program :
    void main()
    {
    int a=1,b=2,c=3;
    scanf("%d %*d %d",&a,&b,&c) ;
    printf("a=%d b=%d c=%d",a,b,c);
    }
    [NOTE : 3 values entered by the user are:100 200 300]
    (a)1 2 3 (b)100 200 300 (c)100 200 3 (d)100 300 3
    Ans. (d)
    Have you run the above programs? Better you run it and let us know :)

    Regards

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Do they even put 'void main()' in course material? I'd refuse to answer those
      questions then.

      kind regards,

      Jos

      Comment

      Working...