Programming Questions

Q:

What would be the output of the following program ?

main()

{

     const int x = 5; 

      int *ptrx;

      ptrx = &x;

      *ptr = 10;

       printf ("%d", x);

}

A) 5 B) 10
C) Error D) Garbage value
 
Answer & Explanation Answer: B) 10

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Programming

2 13759
Q:

Which Of The Following Statements Is Most Accurate For The Declaration X = Circle()?

A) x contains a reference to a Circle object B) You can assign an int value to x
C) x contains an object of the Circle type D) x contains an int value
 
Answer & Explanation Answer: A) x contains a reference to a Circle object

Explanation:
Report Error

View Answer Report Error Discuss

10 13474
Q:

If the following program (myprog) is run from the command line as 

myprog 1 2 3 

what would be the output?

main(int argc, char *argv[])

{

    int i, j = 0;

    for (i = 0; i < argc ; i++)

           j = j + atoi ( argv[i]);

    printf ("%d", j);

}

A) 123 B) 6
C) Error D) "123"
 
Answer & Explanation Answer: B) 6

Explanation:

When atoi() tries to convert argv[0] to a number it cannot do so (argv[0] being a file name) and hence returns a zero.

Report Error

View Answer Report Error Discuss

Filed Under: Programming

2 12909
Q:

What is the output of this C code?

        #include <stdio.h>
        void main()
        {
            int y = 3;
            int x = 5 % 2 * 3 / 2;
            printf("Value of x is %d", x);
        }

A) Value of x is 1 B) Value of x is 2
C) Value of x is 3 D) Compile time error
 
Answer & Explanation Answer: A) Value of x is 1

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Programming

2 12633
Q:

The output of the code below is

        #include <stdio.h>
        int *m()
        {
            int *p = 5;
            return p;
        }
        void main()
        {
            int *k = m();
            printf("%d", k);
        }

A) 5 B) Junk value
C) 0 D) Error
 
Answer & Explanation Answer: A) 5

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Programming

1 11758
Q:

 What is the output of this C code? 

        #include <stdio.h>
        void m()
        {
            printf("hi");
        }
        void main()
        {
            m();
        }

A) hi B) Run time error
C) None D) Varies
 
Answer & Explanation Answer: A) hi

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Programming

0 11596
Q:

A source program is the program written in which level language  ?

A) Alpha Numeric B) High-Level
C) Symbolic D) Machine
 
Answer & Explanation Answer: B) High-Level

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Programming
Exam Prep: Bank Exams
Job Role: Analyst , Database Administration , IT Trainer

14 10414
Q:

Macro flowchart is also called as

A) Less Detail flowchart B) More detail flowchart
C) Simple detailed flowchart D) None of the above
 
Answer & Explanation Answer: A) Less Detail flowchart

Explanation:

A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task.

Macro flowchart shows the outlines the main segments of program. Macro flowchart is also called as less detail flowchart.

Report Error

View Answer Report Error Discuss

Filed Under: Programming
Exam Prep: AIEEE , Bank Exams , CAT , GATE , GRE
Job Role: Analyst , Bank Clerk , Bank PO

12 10003