Unit No. 10 (Input and Output)
Q.1. Define standard input.
The process of giving something to computer is known as input.
ویپمکرٹوکھچکدےنیےکلمعوکانٹپاہکاجاتےہ۔
The input is mostly given by keyboard.
انٹپزایدہرتیکوبرڈےکذرےعیدایاجاتےہ۔
The term standard input refers to the input via keyboard.
ایعمریانٹپیکاالطصحیکوبرڈےکذرےعیانٹپےسرمادےہ۔
Q.2. List some important functions for input.
Ans: scanf( ) gets( ) getch( ) getche( )
Q.3. What is meant by standard output?
The process of getting something from computer is known as output.
ویپمکرٹےسھچکاحلصرکےنےکلمعوکآؤٹٹپاہکاجاتےہ۔
The output is mostly displayed on monitor.
آؤٹٹپزایدہرتامرٹینرپاظرہوہاتےہ۔
The term standard output refers to the output displayed on monitor.
ایعمریآؤٹٹپیکاالطصحامرٹینرپداھکےئاجےنواےلآؤٹٹپےسرمادےہ۔
The result of a program is the output of that program.
یسکرپورگاماکہجیتناسرپورگاماکآؤٹٹپوہاتےہ۔
Q.4. Write names of two output functions. Where are they stored?
Two output functions are printf( ) and puts( ).
()۔ftrp()اورftiirfدوآؤٹٹپنشکنفںیہ
They are stored in the header file stdio.h.
ںیموفحمظںیہ۔prdidthوہڈیہرافلئ
Q.5. What is the use of “printf” function? Write its syntax.
The printf function is used to display output on the monitor.
نشکنفامرٹینرپآؤٹٹپوکاظرہرکےنےکےیلاامعتسلایکاجاتےہ۔printf
It can display text, constants or values of variables on screen in specified format.
لقتسمایریغتماتیکدقروںوکاظرہرکاتکسےہ۔،ہیوصخمصافرٹیمںیمرکسنیرپنتم
The syntax of printf function is:
:نشکنفاکوحنہیےہprintf
printf(Format String, argument_list);
Q.6. What is control string in printf function?
The control string is given in double quotes.
رٹنکولرٹسگنڈلبوکسٹںیمدییئگےہ۔
It may consist of Text, Format specifiers, Escape sequences and Parameters.
رفاریکرتبیتاورریپارٹیمزاشلموہےتکسںیہ۔،افرٹیمسپیکیفارئ،اسںیمٹسکیٹ
Composed by: M. Umair Nasir
, Unit No. 10 2
Q.7. What is use of format specifiers in C language?
Format specifier is used to specify the format according to which values will be read and
displayed.
افرٹیمسپیفارئاکاامعتسلاسافرٹیمیکواضتحرکےنےکےیلایکاجاتےہسجےکباط قادقاروکھڑ ااورداھکایاجےئا۔
It determines the data type of variable, field width and format of the value.
ڈلیفیکوچڑایئاوردقریکلکشاکنیعترکاتےہ۔،ہیریغتمےکڈاٹییکمسق
Q.8. Why format specifiers are important to be specified in I/O operations?
The format specifiers are important to be specified in I/O Operations.
آرپزنشیںیمافرٹیمیکواضتحرکےنواولںیکواضتحرضوریےہ۔O/I
They inform the compiler about the type of data in a variable during input using scanf( ) or
printing using printf( ).
()اکاامعتسلرکےتوہےئرپگنٹنےکدورانرمبترکےنواےلوکریغتمںیمڈاٹییکمسقےکابرےںیمعلطمرکےتںیہ۔ftiirf()اکاامعتسلرکےتوہےئایpcaif
Q.9. Write down the name and purpose of any two format specifiers.
Two format specifiers include integer format specifier %d and character format specifier %c.
نپی
اشلمںیہ۔c%اوررکرٹکیافرٹیمسپیفارئd%دوافرٹیمسپیکیفارئزںیما جرافرٹیمسپیفارئ
The format specifier %d is used to read or print a decimal integer.
وکااشعرہیدعدوکھڑےنھایرپٹنرکےنےکےیلاامعتسلایکاجاتےہ۔d%افرٹیماسپیفارئ
The character format specifier %c is used to read or print a single character.
یسکاکیرکرٹکیوکھڑےنھایرپٹنرکےنےکےیلاامعتسلوہاتےہ۔c%رکرٹکیافرٹیماسپیفارئ
Q.10. Which symbol is used to start format specifiers?
Format specifiers are started with the symbol %.
ےسرشوعایکاجاتےہ۔%افرٹیمیکواضتحرکےنواولںوکالعتم
Q.11. List three types of format specifiers?
Three types of format specifiers are integer format specifier, character format specifier and
floating-point format specifier.
نپی
رکرٹکیافرٹیمسپیفارئاورولفگنٹوپاٹنئافرٹیمسپیفارئ۔،نیتمسقےکافرٹیمسپیکیفارئںیہا جرافرٹیمسپیفارئ
Q. 12. List five format specifiers for integer values.
Five format specifiers for integer values are %d, %i, %o, %u, and %x.
نپی
۔x%اور،t%،d%،i%،d%ا جروویلیےکےیلاپچنافرٹیماسپیفارئزںیہ
Q.13. List three format specifiers for floating-point values.
Three format specifiers for floating-point values %f, %e and %g.
ےکےیلنیتافرٹیماسپیفارئز۔g% اورe%،f%ولفگنٹوپاٹنئوویلی
Q.14. List the format specifiers for character values.
The format specifiers for character values are %c and %s.
ںیہ۔p%اورc%رکرٹکیوویلیزےکےیلافرٹیمیکواضتحرکےنواےل
Q.15. Write the purpose of %c and %d format specifiers.
The format specifier %c is used for single character values.
وادحرکرٹکیوویلیزےکےیلاامعتسلوہاتےہ۔c%افرٹیمیکواضتحدننکہ
The format specifier %d is used for signed decimal integer value.
دطختسدشہااشعرہیدعدیدعدےکےیلاامعتسلوہاتےہ۔d%افرٹیماسپیفارئ
Composed by: M. Umair Nasir