Programming and Data Structures-Programming in C (GATE Computer Science): Questions 118 - 123 of 134

Get 1 year subscription: Access detailed explanations (illustrated with images and videos) to 913 questions. Access all new questions we will add tracking exam-pattern and syllabus changes. View Sample Explanation or View Features.

Rs. 450.00 or

Question number: 118

» Programming and Data Structures » Programming in C

MCQ▾

Question

What will be output if you will compile and execute the following code?

  1. void main()
  2. {
  3.     int i;
  4.     double a=5.2;
  5.     char *ptr;
  6.     ptr=(char *)&a;
  7.     for(i=0;
  8.     i<=7;
  9.     i++) printf("%d ",*ptr++);
  10. }

Choices

Choice (4) Response

a.

Eight garbage values

b.

error

c.

51 52 52 52 52 52 20 64

d.

-51 - 52 - 52 - 52 - 52 - 52 20 64

Question number: 119

» Programming and Data Structures » Programming in C

MCQ▾

Question

What will be output if you will compile and execute the following code?

  1. void main()
  2. {
  3.     static main;
  4.     int x;
  5.     x=call(main);
  6.     clrscr();
  7.     printf("%d ",x);
  8.     getch();
  9. }
  10. int call(int address)
  11. {
  12.     address++;
  13.     return address;
  14. }

Choices

Choice (4) Response

a.

error

b.

0

c.

1

d.

garbage value

Question number: 120

» Programming and Data Structures » Programming in C

MCQ▾

Question

  1. main() {
  2.     int i = 5;
  3.     printf(“ % d % d % d % d % d % d”, i++, i–, ++i, –ii);
  4. }

Choices

Choice (4) Response

a.

66334

b.

5545454

c.

34455

d.

45545

Question number: 121

» Programming and Data Structures » Programming in C

MCQ▾

Question

What will be output if you will compile and execute the following c code?

  1. void main()
  2. {
  3.     int a=25;
  4.     clrscr();
  5.     printf("%o %x",a,a);
  6.     getch();

Choices

Choice (4) Response

a.

31 19

b.

12 42

c.

25 25

d.

025 0x25

Question number: 122

» Programming and Data Structures » Programming in C

MCQ▾

Question

What will be output if you will compile and execute the following c code?

  1. #include "string.hvoid main()
  2. {
  3.     clrscr();
  4.     printf("%d%d",sizeof("string"),strlen("string"));
  5.     getch();
  6. }

Choices

Choice (4) Response

a.

76

b.

66

c.

77

d.

67

Question number: 123

» Programming and Data Structures » Programming in C

MCQ▾

Question

What will be output if you will compile and execute the following code?

  1. void main()
  2. {
  3.     int i=10;
  4.     static int x=i;
  5.     if(x==iprintf("Equal");
  6.     else if(x>iprintf("Greater than");
  7.     else printf("Less than");
  8. }

Choices

Choice (4) Response

a.

error

b.

Greater than

c.

Less than

d.

Equal

Sign In