Jared Sherrick
Quiz von , erstellt am more than 1 year ago

A quiz for FEH students over C/C++ material.

30
1
0
Jared Sherrick
Erstellt von Jared Sherrick vor fast 8 Jahre
Schließen

FEH C/C++ Quiz

Frage 1 von 18

1

Fülle die Lücke, um den Text zu vervollständigen

In C/C++, using the printf command to display something to the command terminal is the same as using the fprintf command except the fprintf command has as the first argument.

Erklärung

Frage 2 von 18

1

Which line of code below will generate a segmentation fault error when it compiles?

Wähle eine der folgenden:

  • scanf("format", &var1, &var2);

  • scanf("format", &var1, &var2)

  • scanf("format", var1, var2);

  • scanf("format", var1, var2)

Erklärung

Frage 3 von 18

1

When reading a string with scanf, an & is required.

Wähle eins der folgenden:

  • WAHR
  • FALSCH

Erklärung

Frage 4 von 18

1

In the following code, which line(s) contains an error?

1 int main()
2 {
3 FILE fptr1;
4 int memes;
5 fptr = fopen("Exan.txt","r");
6 if (*fptr1 != NULL)
7 {
8 printf("File opened successfully!\n\n");
9 }
10 fscanf (fptr1, "%d", memes);

Wähle eine der folgenden:

  • 3, 6, 10

  • 3, 10

  • 3, 6, 8

  • 8, 10

Erklärung

Frage 5 von 18

1

The following loop will stop executing when the end of file condition is detected (assume inptr has been declared as a file pointer already):
while (!feof(inptr))

Wähle eins der folgenden:

  • WAHR
  • FALSCH

Erklärung

Frage 6 von 18

5

--- This is the AND operator in C/C++
--- This is the OR operator in C/C++
--- This is the NOT operator in C/C++
--- This is the Assignment operator in C/C++
--- This is the Equality operator in C/C++

Klicke und ziehe, um den Text zu vervollständigen.

    ==
    =
    !
    ||
    &&

Erklärung

Frage 7 von 18

1

Fülle die Lücke, um den Text zu vervollständigen

When writing input and output in C++, it is necessary to write std:: before every cin and cout, unless you write .

Erklärung

Frage 8 von 18

1

Fülle die Lücke, um den Text zu vervollständigen

When writing in C++, it is necessary to use this symbol on occasion "::". Its name is the operator.

Erklärung

Frage 9 von 18

1

<< ---
>> ---

Klicke und ziehe, um den Text zu vervollständigen.

    Insertion Operator
    Extraction Operator
    Double Arrow Operator

Erklärung

Frage 10 von 18

1

Fülle die Lücke, um den Text zu vervollständigen

Please enter the C++ command to open a file named Santa.txt. Note: assume a file pointer named fin has already been created.

Erklärung

Frage 11 von 18

1

A function prototype needs a semicolon to terminate it.

Wähle eins der folgenden:

  • WAHR
  • FALSCH

Erklärung

Frage 12 von 18

1

In the multidimensional array declared as in Christmas[3][4]; , The [3] refers to the number of columns, while the [4] refers to the number of rows.

Wähle eins der folgenden:

  • WAHR
  • FALSCH

Erklärung

Frage 13 von 18

1

Fülle die Lücken, um den Text zu vervollständigen.

Pointer math:
Assume pointer elf has an address of 2000 points to a value of 10. Solve the following questions using C math and pointer math.
elf + 4 = ;
pow(*elf, 2) = ;

Erklärung

Frage 14 von 18

1

A struct must be terminated with a semicolon before the int main().

Wähle eins der folgenden:

  • WAHR
  • FALSCH

Erklärung

Frage 15 von 18

1

All members of a struct are private.

Wähle eins der folgenden:

  • WAHR
  • FALSCH

Erklärung

Frage 16 von 18

1

A constructor function has a return type.

Wähle eins der folgenden:

  • WAHR
  • FALSCH

Erklärung

Frage 17 von 18

1

The dot (.) operator is used in classes to access class member data and functions.

Wähle eins der folgenden:

  • WAHR
  • FALSCH

Erklärung

Frage 18 von 18

1

Assume Claus is a pointer variable of the type of a struct that has already been declared. Assume Presents is a variable within the aforementioned struct that has a value of 20. When the code below executes, the line "Presents for all good boys and girls" will be printed to the screen.

if (Claus.Presents == 20) {
cout << "Presents for all good boys and girls\n";
}
else {
cout << "Naughty kids get coal!\n";
}

Wähle eins der folgenden:

  • WAHR
  • FALSCH

Erklärung