|
INTERVIEW QUESTIONS
PROGRAMMING LANGUAGES
C++
DETAILS
Question: What are the advantages of using cin and cout compared to scanf(...) and printf(...), respectively?
Answer: Compared to the standard C functions printf() and scanf(), the usage of the cin and cout is more type safe. The format strings, which are used with printf() and scanf() can define wrong format specifies for their arguments, for which the compiler does not warn. In contrast, argument checking with c in and cout is performed by the compiler. C in and Cout are stream classes that could be used to receive and print objects respectively.
|
|
|
Category |
C++ Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 8953 users |
Added on |
5/3/2016 |
Views |
67978 |
Rate it! |
|
|
Question:
What are the advantages of using cin and cout compared to scanf(...) and printf(...), respectively?
Answer:
Compared to the standard C functions printf() and scanf(), the usage of the cin and cout is more type safe. The format strings, which are used with printf() and scanf() can define wrong format specifies for their arguments, for which the compiler does not warn. In contrast, argument checking with c in and cout is performed by the compiler. C in and Cout are stream classes that could be used to receive and print objects respectively. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What are static members and static functions?
|
View Answer
|
|
What are storage qualifiers in C++ ?
|
View Answer
|
|
What is the use of default constructor?
|
View Answer
|
|
What are tokens in C++?
|
View Answer
|
|
Define destuctors ?
|
View Answer
|
|
What is the difference between a template class and class template?
|
View Answer
|
|
What are the differences between new and malloc ?
|
View Answer
|
|
What is difference between template and macro ?
|
View Answer
|
|
What do you mean by early binding?
|
View Answer
|
|
How can we access protected and private members of a class?
|
View Answer
|
|
what should the 64-bit integer type on new,64-bit machines be?
|
View Answer
|
|
Applications of c++ object oriented programs?
|
View Answer
|
|
What is a mutable member?
|
View Answer
|
|
Define a constructor - What it is and how it might be called (2 methods).
|
View Answer
|
|
Anything wrong with this code? T *p = 0; delete p;
|
View Answer
|
|
Anything wrong with this code? T *p = new T[10]; delete p;
|
View Answer
|
|
What is an orthogonal base class?
|
View Answer
|
|
What is an adaptor class or Wrapper class?
|
View Answer
|
|
What is the dangling pointer in c++
|
View Answer
|
|
What is a mixin class?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All C++ Interview Questions & Answers - Exam Mode /
Learning Mode
|