1/39
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What key is used to enter insert mode in Vim?
i
r
t
m
i
How can you save changes to a file and exit vim?
:write&exit
:save&quit
:exit
:wq
:wq
Which command is used to delete the character under the cursor?
d
z
r
x
x
What does the u key do in normal mode?
Moves the cursor to the end of the line
Copies the current line
Deletes the current line
Undoes the last change
Undoes the last change
How do you search forward for a specific word in Vim?
?word
&word
/word
#word
/word
Which command is used to copy the current line in normal mode?
cc
yy
dd
pp
yy
How can you move the cursor to the beginning of the current line?
$
H
0
G
0
What does the command :q! do?
Quits Vim with confirmation
The correct is not listed
Exits without saving changes
Saves changes and exits
Exit without saving changes
Which mode allows you to navigate and manipulate highlighted text?
Command mode
Visual mode
Insert mode
Replace mode
Visual mode
What does the :help command do?
Creates a new Vim session
Displays a help message
Opens a new empty bugger
Opens a file or editing
Displays a help message
What statement is true about the C++ language?
It is interpreted
It is compiled
None of these answers are correct
It was invented in 1968
It is compiled
How do you create an array of 20 integers called nums in C++?
nums[20]
int nums = new int[20];
integer nums[20];
int nums[20];
int nums[20];
In the C++ language when building a class, the function prototypes must be in a header file (.h) and the implementation must be separate in the .cpp file
True
False
False
When building a class in C++, it is good practice to make the data members public so that other classes can quickly access them. This is what makes C++ a fast language.
True
False
False
This program will compile and run just fine:
#include
int main()
{
cout << "Hello World\n";
return 0;
}
True
False
False
What kind of code do computers understand?
Bro Code
Source Code
Machine Code
Assembly Code
Machine Code
What is the linux command to show the contents of a file?
cat
show
There are 2 correct answers listed
more
There are 2 correct answers listed
(cat and more)
What linux command is used to print "Hello World" on the terminal
push Hello World
type Hello World
echo Hello World
print Hello World
echo Hello World
Suppose there is a class called Card which is a playing card and suppose I have a vector of cards called deck. Consider the following code segment:
vector
Card c1('A','S'); // create a card
????? // add the card to the deck
What is the statement that will add the card to the deck?
deck = c1;
deck.push_back(c1);
deck.put(c1);
deck.add(c1);
deck.push_back(c1);
What is the name of the linux root directory?
/
./
../
root
/
Suppose I have a file numbers.dat with the numbers 1 through 1000 sorted, one number per line. What will be printed on the screen if I type this command sequence:
$ more numbers.dat | tail -100 | head -20 | tail -1
921
920
none of these answers is correct
901
920
Consider the following code segment in C++:
int A[ ] = {0, 1, 2, 3, 4, 5};
int *ptr = A;
How would I print 5 to the screen?
cout << ptr[5];
cout << *ptr[5];
cout << ptr * 5;
cout << ptr + 5;
cout << ptr[5];
Consider this code segment:
int x = 10;
int y = 20;
int z = mystery(x, y);
cout << z << "/" << x + y;
Also consider this function:
int mystery(int a, int &b)
{
a += 5;
b += 5;
return a + b;
}
What prints to the screen?
40/30
40/35
30/40
35/40
40/35
What is wrong with the following C++ program:
#include
using namespace std;
int main()
{
int x=3, y=5; // line 1
int * ptr; // line 2
int *ptr2 = &y ; // line 3
y = x; // line 4
ptr = & x; // line 5
cout << x << y << ptr;
return 0;
}
line 2 is wrong
line 3 is wrong
line 5 is wrong
nothing is wrong
nothing is wrong
Consider the following C++ code:
int a = 10;
int *ptr = &a;
cout << ptr;
What is printed out?
the number 10
the memory address of ptr
the contents of a
the memory address of a
the memory address of a
Consider the following segment of code in C++:
int nums[10] = {1,2,3,4,5,6,7,8,9,10};
printArray(nums);
Also consider the this function:
void printArray(int n[ ])
{
for(int i=0, i < n.size(), i++)
cout << n[i];
}
How many numbers will the printArray( ) function actually print out?
10
all the numbers in the array
the correct answer is not listed
1
the correct answer is not listed
Consider the following program. What will is the output?
#include
#include
using namespace std;
int main()
{
vector
for (auto i=0; i
15
Consider this code segment:
int nums[10];
nums[10] = 999;
Which of the following statements is true?
There is nothing wrong with the code.
The code will compile but there is something wrong with this code.
The code will not compile.
C++ is a dangerous motorcycle and you could be mortally wounded if you try to use it!!!
The code will compile but there is something wrong with this code
Using linux commands, how would I find out more about the wc command?
more wc
help wc
man wc
list wc
man wc
What can be understood from the following Linux command and result:
$ time sort numbers.dat > sorted.out &
real 0m1.593s
user 0m5.128s
sys 0m0.184s
The command took about 6.9 seconds to run (1.6 + 5.1 + 0.2).
The command took about 1.6 seconds to run.
The command took about 5.1 seconds to run.
The command took about 0.2 seconds to run.
The command took about 1.6 seconds to run
Assume the following C++ code segment:
struct student
{
string name;
int age;
char grade;
};
student s1, *sptr;
sptr = &s1;
s1.name = "MasterGold";
What code would you use to set Master Gold's grade to A?
The correct answer is not listed
sptr.grade = 'A'
s1->grade = 'A';
MasterGold->grade = 'A';
The correct answer is not listed.
Assume the following C++ code segment:
struct student
{
string name;
int age;
char grade;
};
student s1, *sptr;
sptr = &s1;
s1.name = "MasterGold";
What code would you use to set Master Gold's age to 49?
student.age = 49;
sptr->age = 49;
sptr.age = 49;
The correct answer is not listed.
sptr->age = 49;
The function pthread_create( ) has how many parameters?
1
3
4
2
4
Consider the following C++ code segment:
char word[10] = "matrix";
cout << strlen(word);
What will be printed to the screen?
The correct answer is not listed
10
matrix
6
6
The function pthread_create( ) allows a program to have multiple threads running concurrently.
True
False
True
Consider the following C++ code segment:
char name[15] = "PonyExpress";
char * cptr = name;
name = "cowboy";
cout << name;
Which of the following is true:
You can't assign "cowboy" to name
There is overflow on the first line
Cowboys can't be in the Pony Express
You can't assign an array to a pointer
You can't assign "cowboy" to name
In which c++ library is strlen( ) found?
The correct answer is not listed.
What is another name for "null terminated character array"
word
The correct answer is not listed
container
C-string
C-string
The following C++ function receives an array of integers and a particular index in that array. Index is within the bounds of the passed array. The cout statement will correctly print the desired element. Which of the answers will print the same correct output that is printed by this function?
int showElement(int A[ ], int index)
{
cout << A[index];
}
cout << *(A + index);
cout << &A + index;
cout << &A[index];
cout << *A + index;
cout << *(A + index);
Consider the following valid C++ function:
void func(char * ptr)
{
cout << ptr;
}
What is the passing mode used in the function to pass the parameter ptr?
pass by reference
pass by linkage
pass by touchdown
pass by value
pass by value