Quiz 2: C++ Basics

Quiz
•
Computers
•
University
•
Medium
Xin Yang
Used 38+ times
FREE Resource
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following string variable declaration and statements:
string title;
int i;
title = "One String";
which of the following is the correct statement that assigns the length of the variable title to the variable i?
i = One String.length();
i = string.length();
i = title.length();
i = length();
2.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Given the following string variable declaration and statements:
string title;
int j;
title = "This is Adam";
cout << title.substr(1,5) << endl;
What is the correct output?
3.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Write a C++ statement that declares the variable firstInitial to be a character variable.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following string variable declaration:
string name;
string lastName = "Green";
string firstName = "Cathy";
which of the following statement is the correct statement that assigns Green, Cathy to the variable name.
name = "Green Cathy";
name = lastName +", " + firstName;
name = Green, Cathy;
name = Green + ", " + Cathy;
5.
FILL IN THE BLANK QUESTION
1 min • 1 pt
What is the result of the following expression?
9/8
6.
FILL IN THE BLANK QUESTION
1 min • 1 pt
What is the result of the following expression?
11%9
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct function call to calculate 12^5
power(12,5)
power(5,12)
pow(12,5)
exp(12,5)
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Module 5 & Module 6

Quiz
•
University - Professi...
15 questions
Quiz Ke 6 alprog if-09

Quiz
•
University
10 questions
Java Static

Quiz
•
University
10 questions
java operators

Quiz
•
University
10 questions
Apps Script Quiz - Day 4 Lesson

Quiz
•
University
15 questions
Web Technology

Quiz
•
University
10 questions
CSNP-04103 Chapter 6 - Functions

Quiz
•
University
10 questions
IOTA : Web Development Bootcamp Quiz 3

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University