logo

Crowdly

Browser

Add to Chrome

CC - P1 - Promo 2029

Looking for CC - P1 - Promo 2029 test answers and solutions? Browse our comprehensive collection of verified answers for CC - P1 - Promo 2029 at moodle.myefrei.fr.

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

After executing the following lines of instructions, what is the value of *p ?

int a = 3;

int b = 5;

int * p = &a;

a = b;

View this question

Assuming that the user enters the value -1, what will the following program display?

#include<stdio.h>

int main() {

int a;

scanf("%d", &a);

if (a < 10)

printf("a is less than 10\n");

printf("a is greater than 10\n");

return 0;

}

View this question

We want to write a swap_array function that swaps the values of the elements at indices i and j of an array t (we assume that i and j are valid indices). Among the following definitions, which one is the correct implementation of the swap function ?

0%
0%
0%
0%
View this question

After executing the following program, how many times is the string "hello" displayed?

#include <stdio.h>

int main() {

int i = 0;

while (i < 5) {

int i = 0;

printf("hello\n");

i++;

}

return 0;

}

0%
0%
0%
View this question

Consider the following program. Among the following statements, which ones are true?

#include<stdio.h>

#define N 10

int main() {

int t[] = {1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1};

int l = 0, r = N - 1;

int cpt = 0;

while (l <= r) {

cpt++;

int m = l + (r - l) / 2;

if (t[m] == 1) {

l = m + 1;

} else {

r = m - 1;

}

}

printf("%d %d\n", l, cpt);

return 0;

}

View this question

Consider the following string char s[] = "abcde". Among the following statements, which ones are true?

0%
0%
0%
0%
View this question

What is the output of the following program?

#include<stdio.h>

int main() {

int i = 0, j = 0;

char str[10] = "abcdef";

char str2[10];

while (str[i] != '\0') {

i++;

}

str2[i] = '\0';

while (i >= 0) {

str2[--i] = str[j++];

}

printf("%s\n", str2);

return 0;

}

View this question

After executing the following instructions, what are the values of the variables str1 and str2 ?

char str1[100] = "abcd";

char str2[100] = "efgh!";

char * p1 = str1;

char * p2 = str2;

while (*p2 != '\0') p2++;

while (*p1 != '\0') *(p2++) = *(p1++);

*p2 = '\0';

View this question

We want to dynamically allocate space for a string of length n. Among the following statements, which one allows to achieve this?

0%
0%
0%
0%
View this question

The selection sort algorithm allows to sort an array in a certain order. Among the following statements, which one best describes this sorting algorithm?

0%
0%
0%
0%
View this question

Want instant access to all verified answers on moodle.myefrei.fr?

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

Browser

Add to Chrome