C++ and Linux Exam Q&A: Vim, Syntax, and Commands, Exams of Nursing

Questions and answers on C++ and Linux, covering vim, C++ syntax, data structures, and basic Linux operations. The questions test understanding of fundamental concepts and practical skills in programming and system administration. Useful for students learning C++ and Linux, it helps assess knowledge and prepare for exams. Topics include array manipulation, function definitions, memory management in C++, and common Linux commands. A valuable resource for self-assessment and exam preparation in computer science, offering a comprehensive review of essential topics and concepts. Structured to facilitate learning and retention, it's effective for students and professionals. The questions cover a wide range of topics, ensuring a thorough understanding.

Typology: Exams

2024/2025

Available from 06/26/2025

TOPGradeBooster.
TOPGradeBooster. 🇺🇸

3.6

(63)

13K documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CECS 325 Final Exam Questions and Answers
What key is used to enter insert
mode in Vim?
I
M
R
T
I
How can you save changes to a file
and exit Vim?
:exit
:wq
:write&exit
:save&quit
:wq
What does the u key do in normal
mode?
Moves the cursor to the end of line
Undoes the last change
Deletes the current line
Copies the current line
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?
Pp
Cc
Yy
Dd
Yy
How can you move the cursor to
the beginning of the current line?
0
G
H
$
0
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download C++ and Linux Exam Q&A: Vim, Syntax, and Commands and more Exams Nursing in PDF only on Docsity!

CECS 325 – Final Exam Questions and Answers

What key is used to enter insert mode in Vim?

  • I
  • M
  • R
  • T

I

How can you save changes to a file and exit Vim?

  • :exit
  • :wq
  • :write&exit
  • :save&quit :wq What does the u key do in normal mode?
  • Moves the cursor to the end of line
  • Undoes the last change
  • Deletes the current line
  • Copies the current line 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?
  • Pp
  • Cc
  • Yy
  • Dd Yy How can you move the cursor to the beginning of the current line?
  • 0
  • G
  • H
  • $

What does the command :q! Do?

  • Exits without saving changes
  • Saves changes and exits
  • Quit Vim with confirmation
  • The correct answer is not listed Exits without saving changes Which mode allows you to navigate and manipulate highlighted text?
  • Insert mode
  • Command mode
  • Replace mode
  • Visual mode Visual mode What does the :help command do?
  • Displays a help message
  • Creates a new Vim session
  • Opens a file for editing
  • Opens a new empty buffer 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++?
  • Int nums = new int[20];
  • Nums[20]
  • Int nums[20];
  • Integer 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

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 deck; // create a vector of cards 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.put(c1);
  • Deck.push_back(c1);
  • Deck.add(c1);
  • Deck = c1; Deck.push_back(c1); What is the name of the linux root directory?
  • ./
  • ../
  • /
  • Root

Suppose I have a file numbers.dat with the number 1 through 1000 sorted, one number per line. What will be printed on the screen if I typed this command sequence: $ more numbers.dat | tail - 100 | head

  • 20 | tail - 1
  • 920
  • None of these answers are correct
  • 901
  • 921

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 the following C++ code: int a = 10; Int *ptr = &a; cout << ptr; What is printed out?

  • The memory address of ptr
  • The number 10
  • The memory address of a
  • The contents 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 this function: Void printarray(int n[]) { For(int i = 0, int < n.size(), i++) cout << n[i]; } How many numbers will the printarray() function actually print out?

  • All the numbers in the array
  • 10
  • 1
  • The correct answer is not listed The correct answer is not listed Consider the following program. What will be the output? #include <iostream? #include using namespace std; int main() { Vector v; For(auto i = 0l i < 10; i++) v.push_back(i*5); vector::interator it = v.begin(); cout << *(it+3); Return 0; }
  • It will not compile
  • 5
  • 3
  • 15

Assume the following 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?

  • S1 - > grade = 'A';
  • Mastergold - >grade = 'A';
  • The correct answer is not listed
  • Sptr.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?
  • The correct answer is not listed.
  • Student.age = 49;
  • Sptr.age = 49;
  • Sptr->age = 49; Sptr->age = 49; The function pthread-create() has how many parameters?
  • 3
  • 2
  • 1
  • 4 4 parameters

Consider the following C++ code segment: Char world[10] = "matrix"; cout << strlen(word);

  • Matrix
  • 6
  • The correct answer is not listed
  • 10

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 an array to a pointer
  • Cowboys can't be in the Pony Express
  • You can't assign "cowboy" to name
  • There is overflow on the first line 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
  • Container
  • C-string
  • The correct answer is not listed C-string

What is the error int the following function definition? Int doubler(int old_value) { Double new_value = old_value * 2; }

  • No error
  • The function returns a value of type double
  • The function attempts to modify its input parameter
  • The function does not return a value The function does not return a value