FEH C/C++ Quiz

Beschreibung

A quiz for FEH students over C/C++ material.
Jared Sherrick
Quiz von Jared Sherrick, aktualisiert more than 1 year ago
Jared Sherrick
Erstellt von Jared Sherrick vor fast 8 Jahre
30
1

Zusammenfassung der Ressource

Frage 1

Frage
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 [blank_start]stdout[blank_end] as the first argument.
Antworten
  • stdout

Frage 2

Frage
Which line of code below will generate a segmentation fault error when it compiles?
Antworten
  • scanf("format", &var1, &var2);
  • scanf("format", &var1, &var2)
  • scanf("format", var1, var2);
  • scanf("format", var1, var2)

Frage 3

Frage
When reading a string with scanf, an & is required.
Antworten
  • True
  • False

Frage 4

Frage
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);
Antworten
  • 3, 6, 10
  • 3, 10
  • 3, 6, 8
  • 8, 10

Frage 5

Frage
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))
Antworten
  • True
  • False

Frage 6

Frage
[blank_start]&&[blank_end] --- This is the AND operator in C/C++ [blank_start]||[blank_end] --- This is the OR operator in C/C++ [blank_start]![blank_end] --- This is the NOT operator in C/C++ [blank_start]=[blank_end] --- This is the Assignment operator in C/C++ [blank_start]==[blank_end] --- This is the Equality operator in C/C++
Antworten
  • ==
  • =
  • !
  • ||
  • &&

Frage 7

Frage
When writing input and output in C++, it is necessary to write std:: before every cin and cout, unless you write [blank_start]using namespace std;[blank_end].
Antworten
  • using namespace std;

Frage 8

Frage
When writing in C++, it is necessary to use this symbol on occasion "::". Its name is the [blank_start]binary scope resolution[blank_end] operator.
Antworten
  • binary scope resolution

Frage 9

Frage
<< --- [blank_start]Insertion Operator[blank_end] >> --- [blank_start]Extraction Operator[blank_end]
Antworten
  • Insertion Operator
  • Extraction Operator
  • Double Arrow Operator

Frage 10

Frage
Please enter the C++ command to open a file named Santa.txt. Note: assume a file pointer named fin has already been created. [blank_start]fin.open(“SANTA.txt");[blank_end]
Antworten
  • fin.open(“Santa.txt");

Frage 11

Frage
A function prototype needs a semicolon to terminate it.
Antworten
  • True
  • False

Frage 12

Frage
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.
Antworten
  • True
  • False

Frage 13

Frage
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 = [blank_start]2016[blank_end]; pow(*elf, 2) = [blank_start]100[blank_end];
Antworten
  • 2016
  • 100

Frage 14

Frage
A struct must be terminated with a semicolon before the int main().
Antworten
  • True
  • False

Frage 15

Frage
All members of a struct are private.
Antworten
  • True
  • False

Frage 16

Frage
A constructor function has a return type.
Antworten
  • True
  • False

Frage 17

Frage
The dot (.) operator is used in classes to access class member data and functions.
Antworten
  • True
  • False

Frage 18

Frage
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"; }
Antworten
  • True
  • False
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Orbital Mechanics
Luke Hansford
Software Processes
Nurul Aiman Abdu
Module 1: Introduction to Engineering Materials
Kyan Clay
Mathematics
rhiannonsian
AOCS - Attitude and orbit control systems
Luke Hansford
Ordinary Differential Equations
rhiannonsian
audio electronics
Lillian Mehler
Building Structures
Niat Habtemariam
communication system
Lillian Mehler
Advanced Propulsion
Luke Hansford