Quiz
C programming basics: variables, functions, loops
Erstelle ein kostenloses Konto, um dieses Quiz zu beenden
Speichere deinen Fortschritt und sieh dir dein Endergebnis an.
oder mit deiner E-Mail registrieren
Schon ein Konto? Anmelden
Fragen in diesem Quiz (14)
1Declaring variables
Which of the following statements correctly declare variables?- Aint sum = 5;
- Bsum = 7;
- Cvoid x = 31;
- Ddouble d = 2.5;
2What is the result of 45 / 4?
- A11.25
- B12
- C10
- D11
3Declaring functions
Which of the following declare a function that sums two numbers and gives the result to the caller?- Adouble sum(double d1, double d2) { return d1 + d2; }
- Bvoid sum(double d1, double d2) { return d1 + d2; }
- Cdouble sum(double d1, double d2) { d1 + d2; }
- Dvoid sum(double d1, double d2) { sum = d1 + d2; }
4Character values
Which of the following is the correct expression of the character 7?- A7
- B'7'
- C"7"
- D<7>
5Assignment operator
________ is the assignment operator.- A=
- B:=
- C=:
- D==
6Printing characters
Suppose c is a char variable with the value 'e'. What is the printout of the statement printf("%c", +
+c)?- Ac
- Bd
- Ce
- Df
7Compiler checks
The compiler checks ________.- ASyntax errors
- BRunetime errors
- CLogical errors
8Declaring strings
Which of the following statements correctly declare a C string?- Astring s = "Hello, World!";
- Bchar s = "Hello, World";
- Cchar s[] = "Hello, World!";
- Dstring s = 'Hello, World!';
9Bits and bytes
One byte usually has ________ bits.- A4
- B8
- C12
- D16
10Main function
Which of the following are valid main functions?- Aint main() { return 0; }
- Bvoid main() { }
- Cint main() { }
- Dvoid main() { return 0; }
11Comments
Which of the following are valid C99 comments?- A// Comment here
- B/* Comment here */
- C/* Comment here
- D// Comment here */
12Local variables
Local variables exist:- AFrom the beginning of the scope to the end of the scope
- BFrom where they are declared to the end of the scope
- CFrom the beginning of the function to the end of the function
- DFrom where they are declared to the end of the function
13For loop
What is the output of the following code:
int i = 0;
for (i = 0; i < 10; i++) { }
printf("%i", i);- A9
- B10
- C11
14Reading values
Which of the following statements correctly use scanf()?- Aint i; scanf("%i", &i);
- Bint i; scanf("%i", i);
- Cdouble d; scanf("%d", &d);
- Ddouble d; scanf("&d", &d);
Informationen
- Beschreibung
- Quiz am Ohne Titel, erstellt von Morten J. am 07/12/2018.
- Autor
- Morten J.
- Sprache
- English
- Aufrufe
- 0
- Verlauf
- Erstellt am 7 Dez 2018 · aktualisiert am 7 Dez 2018
- Bewertung
- Noch keine Bewertungen Bewerte dieses Quiz