Quiz sul linguaggio C

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Qual è il risultato di questo codice?

int i = 0; while(i < 5) { printf('%d', i); i++; }

  • 1 2 3 4
  • 1 2 3 4 5
  • 0 1 2 3 4 (correct)
  • 0 1 2 3 4 5

Quale dichiarazione di switch è corretta?

  • switch(x) { case 1: printf('Uno'); case 2: printf('Due'); default: printf('Altro'); }
  • switch(x) { case 1: printf('Uno'); break; case 2: printf('Due'); default: printf('Altro'); }
  • switch(x) { case 1: printf('Uno'); case 2: printf('Due'); break; default: printf('Altro'); }
  • switch(x) { case 1: printf('Uno'); break; case 2: printf('Due'); break; default: printf('Altro'); } (correct)

Quale algoritmo di ordinamento ha una complessità di tempo O(n^2)?

  • Heap sort
  • Quick sort
  • Merge sort
  • Insertion sort (correct)

Flashcards

While loop

A loop that executes a block of code repeatedly as long as a certain condition is true.

Switch statement

A control flow statement that allows a program to choose between different code blocks based on the value of an expression.

Insertion sort

An algorithm that sorts an array by repeatedly stepping through the array, comparing adjacent elements, and swapping them if they are in the wrong order.

Study Notes

Ciclo while

  • Il ciclo while esegue un blocco di istruzioni finché una condizione rimane vera.
  • Nell'esempio, il ciclo while continua a eseguire il blocco di istruzioni finché i è minore di 5.

Output del ciclo while

  • L'output del ciclo while sarà 01234, poiché il valore di i viene stampato a ogni iterazione.

Dichiarazione di switch

  • La dichiarazione di switch corretta è switch (espressione) {case valore1: ... break; case valore2: ... break; ... default: ... break;.

Algoritmo di ordinamento

  • L'algoritmo di ordinamento con complessità di tempo O(n^2) è la bubble sort.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Use Quizgecko on...
Browser
Browser