[試題] 107-1 林達德 計算機程式語言 期中考

作者: unmolk (UJ)   2018-11-30 02:00:57
課程名稱︰計算機程式語言
課程性質︰大一必修
課程教師︰林達德
開課學院:生農學院
開課系所︰生機系
考試日期(年月日)︰2018.11.08
考試時限(分鐘):120
是否需發放獎勵金:是
試題 :
Problem 1:(20 points)
Briefly explain the following terms:
(1) ASCII
(2) pass by reference
(3) coercion
(4) function overload
(5) machine language
(6) syntax error
(7) function prototype
(8) nested loops
(9) continue
(10) global varaible
Problem 2:(10 points)
What is output by the following code segment?
for( int i=0; i<5; i++){
for( int j=0; j<9; j++){
if( j%3 == 0)
cout << '#';
else
cout << '$';
}
cout << endl;
}
Problem 3:(10 points)
What is the output of the following program?
#include <iostream>
using namespace std;
void teststat();
int k = 20;
int main()
{
int count;
int k=60;
for(count=0; count<5; count++)
teststat();
cout MM "The value of k is " << k << endl;
return 0;
}
void teststat()
{
static int num = 0;
cout << "The value of num is " << num << endl;
cout << "The value of k is " << k << endl;
num++;
k++;
return;
}
Problem 4:(10 points)
Write a program that calculates and outputs the prime numbers from 2 tp N.
The number N is to be input by the user and the output is on the screen.
Problem 5:(10 points)
Write a function that computes and returns the value of cos(x) by using the
following formula. The arguments of this function are the value of x (in
radians) and the number of terms, n, of the series.
x^2 x^4 x^6
cos(x) = 1 -

Links booklink

Contact Us: admin [ a t ] ucptt.com