# T22網管組轉社考題:程式設計觀念題
###### tags: `trash`
## 一、單選題(60%)
### 1. 簽到題(一)
```cpp=1
#include<bits/stdc++.h>
#define loli '\n'
signed main(){
std::cout << "Hello world" << loli;
}
```
#### 問:該程式會輸出什麼?
1. Hello world
2. Hello world 並換行
3. 因為沒有
```cpp
using namespace std;
```
因此編譯錯誤
4. 無法識別 loli 導致編譯錯誤
5. 因為 main() 函式並非使用 int 宣告,因此編譯錯誤
---
### 2. 簽到題(二)
```cpp=1
#include<bits/stdc++.h>
using namespace std;
int plus(int a,int b){
return a+b;
}
int main(){
int a,b;
cin >> a >> b;
cout << plus(a,b) << endl;
}
```
#### 問:若輸入(a,b)=(10,6),則輸出為?
1. 60
2. 60、且換行
3. 4、且換行
4. 16、且換行
5. 16
---
### 3.函式
```cpp=1
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
void math(int *a,int *b){
int c=*a,d=*b;
*a=pow((c+d),2); *b=pow((c*d),2);
}
void swh(int *a,int *b){
int c=*a;*a=*b;*b=c;
}
int main(){
int a,b;
cin >> a >> b;
if(b>a)
swh(&a,&b);
math(&a,&b);
cout << (a>b?"Yes":"No") << endl;
}
```
#### 問:若輸入(a,b)=(2,3),則輸出為?
1. Yes
2. No