Languages [3i Infotech Placement]: Sample Questions 181 - 183 of 546

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

Question 181

Edit

Describe in Detail

Essay▾

Write a program to interchange 2 variables without using the third one.

Explanation

  1. #include<stdio.h>
  2. #include<conio.h>
  3. main()
  4. {
  5.     inta=10,b=20;
  6.     clrscr();
  7.     printf(“beforeswapa=%db=%d”, a, b);
  8.     a=a+b
  9.     b=a-b
  10.     a=a-b
  11.     printf(Afterswapa=%db=%d”, a, b);
  12.     getch();
  13. }

OUTPUT

Before swap a = 10 b = 20

After swap a = 20 b = 10

Question 182

Languages
Edit

Write in Short

Short Answer▾

Is there any tag in html to upload and download files?

Explanation

Yes, < input type = “file” > is there tag in html to upload and download files.

Question 183

Edit

Write in Short

Short Answer▾

What is the output of the following program?

  1. main ()
  2. {
  3.     chari =0;
  4.     for (; i>= 0; i ++ );
  5.     printf ( “%d” i);
  6. }

Explanation

Behavior is implementation dependent.

In the program

Table Shows the Program
{

char i = 0;

for (; i >= 0; i ++) ;

printf ( “% d” i) ;

}

  • If the char is signed or unsigned by default is implementation dependent.
  • If the implementation treats the char to be signed by default the program will print -128 and terminate.
  • On the other hand if it considers char to be unsigned by default, it goes to infinite loop.

Rule: You can write programs that have implementation dependent behavior. But don՚t write programs that depend on such behavior.

Developed by: