c语言编程输入a是输出为a_C ++编程基本输入,输出,数据类型,声明能力倾向问题和解答...
c語言編程輸入a是輸出為a
This section contains C++ programming Basic Input, Output, Data types, Declaration etc Aptitude Questions and Answers with explanations.
本節包含C ++編程的基本輸入,輸出,數據類型,聲明等,以及有關解釋的能力問題和解答。
C ++編程基本能力問題列表 (List of C++ programming basic Aptitude Questions and Answers)
1) Which header file is required to run this program? #include <.....> int main() {cout<stdio.h
conio.h
iostream.h
ostream.h
iostream.h
1)運行該程序需要哪個頭文件? 2) Which is the correct statement to print the value of age? #include <iostream.h> int main() {int age=19;.....return 0; }cout << "Age: %d",age;
cout << "Age: %d" << age;
cout << "Age: " + age;
cout << "Age: " << age;
cout << "Age: " << age;
2)哪個是打印age值的正確語句?cout <<“年齡:%d”,年齡;
cout <<“ Age:%d” <<年齡;
cout <<“ Age:” + age;
cout <<“ Age:” <<年齡;
cout <<“ Age:” <<年齡;
3) What will be the output of following program? #include <iostream.h> int a=10; int main() {int a=20;cout<<::a return>10
20
::10
::20
10
:: is a Scope Resolution Operator, it is used to access the value of global variable and ::a will return the value of global declared variable.
Both are same.
'\n' and endl both are used to print new line but endl flushes the buffer after printing new line.
'\n' and endl both are used to print new line but '\n' flushes the buffer after printing new line.
'\n' used in C programming while endl used in C++ programming.
'\n' and endl both are used to print new line but endl flushes the buffer after printing new line.
4)關于'\ n'和endl的正確答案是什么?兩者都一樣。
'\ n'和endl都用于打印新行,但是endl在打印新行后刷新緩沖區。
'\ n'和endl都用于打印新行,但是'\ n'在打印新行后刷新緩沖區。
'\ n'用于C編程,而endl用于C ++編程。
'\ n'和endl都用于打印新行,但是endl在打印新行后刷新緩沖區。
5) Which header file is required to use setw() function?conio.h
iostream.h
stdlib.h
iomanip.h
iomanip.h
setw() is a manipulator and it is declared in iomanip.h header file.
conio.h
iostream.h
標準庫
iomanip.h
iomanip.h
setw()是一個操縱器,它在iomanip.h頭文件中聲明。
To set width of the variable in memory.
To pad the value with space or any defined special character of next variable.
To set the white spaces in the input buffer.
None of these.
To pad the value with space or any defined special character of next variable.
6)為什么要使用setw() ?設置內存中變量的寬度。
用空格或下一個變量的任何已定義特殊字符填充值。
設置輸入緩沖區中的空白。
都不是。
用空格或下一個變量的任何已定義特殊字符填充值。
7) What will be the output of following programs? #include >iostream>using namespace std;int main() {cout <<P"includehelp.com";return 0; }Compile Time Error
Run Time Error
includehelp.com
None of these.
Compile Time Error
編譯時錯誤
運行時錯誤
includehelp.com
都不是。
編譯時錯誤
翻譯自: https://www.includehelp.com/cpp-programming/basic-aptitude-questions-and-answers.aspx
c語言編程輸入a是輸出為a
總結
以上是生活随笔為你收集整理的c语言编程输入a是输出为a_C ++编程基本输入,输出,数据类型,声明能力倾向问题和解答...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c ++ stl_获取列表的第一个和最后
- 下一篇: c ++类成员函数_C ++编程中的数据