Technical Questions

Q:

What will be output of following program ?

#include
int main()

{

int a = 10;
void *p = &a;
int *ptr = p;
printf("%u",*ptr);
return 0;

}

A) 10 B) Address
C) 2 D) Compilation error
 
Answer & Explanation Answer: A) 10

Explanation:

Void pointer can hold address of any data type without type casting. Any pointer can hold void pointer without type casting.

Report Error

View Answer Report Error Discuss

Filed Under: Programming

1 13371
Q:

main()

{

fork();

 

printf(“Hello World!”);

}

Output for the above unix program is

A) Hello World! B) Hello World!Hello World!
C) Hello World D) None
 
Answer & Explanation Answer: B) Hello World!Hello World!

Explanation:

The fork creates a child that is a duplicate of the parent process. The child begins from the fork().All the statements after the call to fork() will be executed twice.(once by the parent process and other by child). The statement before fork() is executed only by the parent process

Report Error

View Answer Report Error Discuss

Filed Under: Operating Systems
Exam Prep: GRE

1 13073
Q:

What will output when you compile and run the following code?

#include <stdio.h>
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();

}

A) 8 B) 7
C) 2 D) Compiler error
 
Answer & Explanation Answer: C) 2

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Programming

1 13023
Q:

The output of the code below is

       #include <stdio.h>
        void main()
        {
            int i = 0, k;
            if ( i == 0 )
                goto label;
                for ( k = 0;k < 3; k++ )
                {
                    printf( "hin" );
                    label: k = printf( "%03d", i );
                }
         }

A) 0 B) hi hi hi 0 0 0
C) 0 hi hi hi 0 0 0 D) 0 0 0
 
Answer & Explanation Answer: A) 0

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Programming

1 12965
Q:

What are the notations used in Evaluation of Arithmetic Expressions using prefix and postfix forms?

A) Polish B) Reverse Polish
C) Both A and B D) None of the above
 
Answer & Explanation Answer: C) Both A and B

Explanation:

Polish and Reverse Polish are the notations used in Evaluation of Arithmetic Expressions using prefix and postfix forms

Report Error

View Answer Report Error Discuss

Filed Under: Database
Job Role: Database Administration

9 12564
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 12435
Q:

void main()

{

char good *better, *best;

printf( "%d..%d", sizeof(better), sizeof(best) );

}

A) 1..2 B) 4..4
C) 4..2 D) 2..2
 
Answer & Explanation Answer: C) 4..2

Explanation:

The second pointer is of char type and not a good pointer.

Report Error

View Answer Report Error Discuss

Filed Under: Programming

4 12375
Q:

What is the output of this C code?

        #include <stdio.h>
        void main()
        {
            int x = 97;
            char y = x;
            printf("%cn", y);
        }

A) a B) 97
C) Run time error D) None
 
Answer & Explanation Answer: A) a

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Programming

1 12266