logo

Crowdly

IT6008 - Computer Programming 1

Looking for IT6008 - Computer Programming 1 test answers and solutions? Browse our comprehensive collection of verified answers for IT6008 - Computer Programming 1 at moodle.polytechnic.bh.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

Trace the following code, what is the output?

boolean flag = false;

int a[] = new int[10];

int i = 1;

while(!flag) {

       a[i] += i;

       if (i >= a.length){

           flag = true;

        }

        System.out.println(a[i]);

       i++;

}

0%
0%
0%
View this question

Trace the following code, what is the output?

int a[] = new int[10];

for(int i = a.length-1; i >= 0; i-=2) {

    a[i] += i ;

    System.out.println(a[i]);

}

View this question

Explain the purpose of the following method:

 

public static boolean check(int[] iNumbers){

   boolean bValid = true;

   for (int i = 0; i < iNumbers.length - 1; i++) {

      if (iNumbers[i] >= iNumbers[i + 1]) {

         bValid = false;

      }

   }

   return bValid;

}

View this question

Trace the following code, what is the output?

int a[] = new int[10];

for(int i = 0; i < a.length; i++) {

        a[i] = i * i;

         System.out.println(a[i]);

}

View this question

How many iterations will be performed in total when executing the following java-code:

for(int i=0;i<5;i++)

           for ( int j = 5; j<=10; j++)

               System.out.println(i + " , " + j);

View this question

What will happen when you attempt to compile and run the following code in a method?

for(int i=0;i<5;)

{

    i++; System.out.println(i);   

}

View this question

Match the repetitions and numbers of their iterations:

View this question

Variables declared inside the repetition block are accessible from the rest of the program.

View this question

What will be printed on the output after the execution of Java-code below:

0%
0%
0%
View this question

Choose a description from the ones listed below that best describes the following flowchart:

 

 

View this question

Want instant access to all verified answers on moodle.polytechnic.bh?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!