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;
The bubble sort algorithm sorts an array by placing the largest element in its place at each iteration. By stopping the algorithm as soon as the array is sorted, in how many iterations is the array int T[6] = {-1, 3, 42, 21, 11, 13} sorted?
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;
}
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;
}
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;
}
We want to dynamically allocate space for a string of length n. Among the following statements, which one allows to achieve this?
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;
}
We want to write a function sum that computes and returns the average of an array of float tab of size n. Among the following statements, which one is the correct function header?
Consider the following string char s[] = "abcde". Among the following statements, which ones are true?
The selection sort algorithm allows to sort an array in a certain order. Among the following statements, which one best describes this sorting algorithm?