[试题] 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