اسئلة واجوبة لسنوات سابقة
  أستــاذ المــادة  هديل قاسم غني
  تـاريـخ النشــر   13/04/2017
Share |


اسئلة امتحان المودل الثالث الخاص بالمصفوفات احادية البعد :

Q1/ Which of the following correctly accesses the seventh element stored in an array named sum with 100 elements?
A. sum (6);
B. sum [7];

C. sum [6];
D. sum [100];

Correct: C

Q2/ What is the index number of the last element of an array with 29 elements?
A. 29
B. 28
C. 0

D. Programmer-defined

Correct: B

Q3/ What will be the output of this program?

# include<iostream.h>

Void main()

{

int array1[] = {1,2,3,4,5};

                    int array2[] = {1,2,3,4,5};

                     int temp, result = 0;

                       int main()

          {

                    for (temp = 0; temp < 5; temp++)

                              { result += array1[temp];

                    }

                     for (temp = 0; temp < 5; temp++)

                                { result += array2[temp];

                      }

          cout << result;

           }

A. 30

B. 20

C. 35

D. 15

Correct: A

Q4/ What will be the output of this program?

          #include<iostream.h>

  int main ()

                  {

                    int array[] = {0, 2, 4, 6, 7, 5, 3};

                    int n, result = 0;

                    for (n = 0; n < 8; n++) {

                       result += array[n];

                    }

              cout << result;

              return 0;

          }

A.  27

B.  28

C.  26

D.  None of the mentioned

Correct: D