3i Infotech Placement: Sample Questions 560 - 562 of 1245

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 560

Edit

Write in Short

Short Answer▾

What is the output of the following program?

  1. main ()
  2. {
  3.     charp[ ] =“%d”;
  4.     p[1] =‘c’;
  5.     printf (p, 65);
  6. }

Explanation

In the program

Table Shows the Program
p [1] = ‘c’ ;
  • Due to the assignment p [1] = ‘c’ the string becomes, “% c” .
printf (p, 65) ;
  • Since this string becomes the format string for printf and ASCII value of 65 is ‘A’ , the same gets printed.

Question 561

Edit

Describe in Detail

Essay▾

What is the difference between MOV and MVI?

Explanation

MOV:

  • Copies contents of the source register into the destination register.
  • Contents of the source register are not altered.
  • If one of the operands is a memory location - location is specified by contents of the HL registers.
  • Example: MOV B, C or MOV B, M

MVI:

  • The data is stored in the destination register or memory.
  • If the operand is a memory location- location is specified by the contents of the HL registers.
  • Example: MVI B, H or MVI M, H

Question 562

Edit

Write in Short

Short Answer▾

What is the output of the following program?

  1. main ()
  2. {
  3.     char ⚹p;
  4.     p =“%d”;
  5.     p ++;
  6.     p ++;
  7.     printf (p − 2, 300);
  8. }

Explanation

In the program

Table Shows the Program
char ⚹ p;Declare character pointer p
p = “% d” ;Pointer p points to ‘% d’
p ++ ;

p ++ ;

It is incremented twice
printf (p − 2,300) ;Decremented by 2, it points to ‘% d’ and 300 is printed.

Developed by: