0% found this document useful (0 votes)
41 views

Introduction to Programming with C++ 3rd Edition Liang Test Bank - Full Version Is Ready For Free Download

The document provides links to various test banks and solution manuals for programming and finance textbooks available for download at testbankdeal.com. It includes specific titles such as 'Introduction to Programming with C++' and 'Corporate Finance Core Principles and Applications'. Additionally, it features a sample C++ programming test with multiple-choice questions and coding exercises.

Uploaded by

zoraidocares
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Introduction to Programming with C++ 3rd Edition Liang Test Bank - Full Version Is Ready For Free Download

The document provides links to various test banks and solution manuals for programming and finance textbooks available for download at testbankdeal.com. It includes specific titles such as 'Introduction to Programming with C++' and 'Corporate Finance Core Principles and Applications'. Additionally, it features a sample C++ programming test with multiple-choice questions and coding exercises.

Uploaded by

zoraidocares
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Download the full version and explore a variety of test banks

or solution manuals at https://testbankdeal.com

Introduction to Programming with C++ 3rd Edition


Liang Test Bank

_____ Follow the link below to get your download now _____

https://testbankdeal.com/product/introduction-to-
programming-with-c-3rd-edition-liang-test-bank/

Access testbankdeal.com now to download high-quality


test banks or solution manuals
We have selected some products that you may be interested in
Click the link to download now or visit testbankdeal.com
for more options!.

Introduction to C++ Programming and Data Structures 4th


Edition Liang Solutions Manual

https://testbankdeal.com/product/introduction-to-c-programming-and-
data-structures-4th-edition-liang-solutions-manual/

Introduction to Programming with C++ 4th Edition Diane Zak


Test Bank

https://testbankdeal.com/product/introduction-to-programming-
with-c-4th-edition-diane-zak-test-bank/

Introduction to Programming with C++ 4th Edition Diane Zak


Solutions Manual

https://testbankdeal.com/product/introduction-to-programming-
with-c-4th-edition-diane-zak-solutions-manual/

Corporate Finance Core Principles and Applications 4th


Edition Ross Test Bank

https://testbankdeal.com/product/corporate-finance-core-principles-
and-applications-4th-edition-ross-test-bank/
Economics 3rd Edition Hubbard Test Bank

https://testbankdeal.com/product/economics-3rd-edition-hubbard-test-
bank/

Cornerstones of Cost Management 4th Edition Hansen


Solutions Manual

https://testbankdeal.com/product/cornerstones-of-cost-management-4th-
edition-hansen-solutions-manual/

Technical Communication 14th Edition Lannon Solutions


Manual

https://testbankdeal.com/product/technical-communication-14th-edition-
lannon-solutions-manual/

Integrated Marketing Communications 4th Edition Chitty


Test Bank

https://testbankdeal.com/product/integrated-marketing-
communications-4th-edition-chitty-test-bank/

Fundamentals of Futures and Options Markets 8th Edition


Hull Test Bank

https://testbankdeal.com/product/fundamentals-of-futures-and-options-
markets-8th-edition-hull-test-bank/
Laboratory Manual For Anatomy And Physiology Featuring
Martini Art Main Version 6th Edition Wood Test Bank

https://testbankdeal.com/product/laboratory-manual-for-anatomy-and-
physiology-featuring-martini-art-main-version-6th-edition-wood-test-
bank/
Name:_______________________ CSCI 2490 C++ Programming
Armstrong Atlantic State University
(50 minutes) Instructor: Dr. Y. Daniel Liang

(Open book test, you can only bring the textbook)

Part I: Multiple Choice Questions:

1
12 quizzes for Chapter 7
1 If you declare an array double list[] = {3.4, 2.0, 3.5, 5.5}, list[1] is ________.

A. 3.4
B. undefined
C. 2.0
D. 5.5
E. 3.4
2 Are the following two declarations the same

char city[8] = "Dallas";


char city[] = "Dallas";

A. no
B. yes
3 Given the following two arrays:

char s1[] = {'a', 'b', 'c'};


char s2[] = "abc";

Which of the following statements is correct?

A. s2 has four characters


B. s1 has three characters
C. s1 has four characters
D. s2 has three characters
4 When you pass an array to a function, the function receives __________.

A. the length of the array


B. a copy of the array
C. the reference of the array
D. a copy of the first element
5 Are the following two declarations the same

char city[] = {'D', 'a', 'l', 'l', 'a', 's'};


char city[] = "Dallas";

1
A. yes
B. no
6 Suppose char city[7] = "Dallas"; what is the output of the following statement?

cout << city;

A. Dallas0
B. nothing printed
C. D
D. Dallas
7 Which of the following is incorrect?

A. int a(2);
B. int a[];
C. int a = new int[2];
D. int a() = new int[2];
E. int a[2];
8 Analyze the following code:

#include <iostream>
using namespace std;

void reverse(int list[], const int size, int newList[])


{
for (int i = 0; i < size; i++)
newList[i] = list[size - 1 - i];
}

int main()
{
int list[] = {1, 2, 3, 4, 5};
int newList[5];

reverse(list, 5, newList);
for (int i = 0; i < 5; i++)
cout << newList[i] << " ";
}

A. The program displays 1 2 3 4 5 and then raises an ArrayIndexOutOfBoundsException.


B. The program displays 1 2 3 4 6.
C. The program displays 5 4 3 2 1.
D. The program displays 5 4 3 2 1 and then raises an ArrayIndexOutOfBoundsException.
9 (Tricky) What is the output of the following code:

#include <iostream>
using namespace std;

2
int main()
{
int x[] = {120, 200, 16};
for (int i = 0; i < 3; i++)
cout << x[i] << " ";
}

A. 200 120 16
B. 16 120 200
C. 120 200 16
D. 16 200 120
10 Which of the following statements is valid?

A. int i(30);
B. int i[4] = {3, 4, 3, 2};
C. int i[] = {3, 4, 3, 2};
D. double d[30];
E. int[] i = {3, 4, 3, 2};
11 Which of the following statements are true?

A. The array elements are initialized when an array is created.


B. The array size is fixed after it is created.
C. Every element in an array has the same type.
D. The array size used to declare an array must be a constant expression.
12 How many elements are in array double list[5]?

A. 5
B. 6
C. 0
D. 4

3 quizzes for Chapter 8


13 Which of the following function declaration is correct?

A. int f(int a[3][], int rowSize);


B. int f(int a[][], int rowSize, int columnSize);
C. int f(int a[][3], int rowSize);
D. int f(int[][] a, int rowSize, int columnSize);
14 What is the output of the following code?

#include <iostream>
using namespace std;

3
int main()
{
int matrix[4][4] =
{{1, 2, 3, 4},
{4, 5, 6, 7},
{8, 9, 10, 11},
{12, 13, 14, 15}};

int sum = 0;

for (int i = 0; i < 4; i++)


cout << matrix[i][1] << " ";

return 0;
}

A. 3 6 10 14
B. 1 3 8 12
C. 1 2 3 4
D. 4 5 6 7
E. 2 5 9 13
15
Which of the following statements are correct?

A. char charArray[2][2] = {{'a', 'b'}, {'c', 'd'}};


B. char charArray[][] = {{'a', 'b'}, {'c', 'd'}};
C. char charArray[][] = {'a', 'b'};
D. char charArray[2][] = {{'a', 'b'}, {'c', 'd'}};
Part II: Show the printout of the following code:

a. (2 pts)
#include <iostream>
using namespace std;

void swap(int n1, int n2)


{
int temp = n1;
n1 = n2;
n2 = temp;
}

int main()
{
int a[] = {1, 2};
swap(a[0], a[1]);
cout << "a[0] = " << a[0] << " a[1] = " << a[1] << endl;

return 0;
}

4
b. (2 pts)
#include <iostream>
using namespace std;

void swap(int a[])


{
int temp = a[0];
a[0] = a[1];
a[1] = temp;
}

int main()
{
int a[] = {1, 2};
swap(a);
cout << "a[0] = " << a[0] << " a[1] = " << a[1] << endl;

return 0;
}

c. (4 pts) Given the following program, show the values of the array
in the following figure:

#include <iostream>
using namespace std;

int main()
{
int values[5];
for (int i = 1; i < 5; i++)
{
values[i] = i;
}

values[0] = values[1] + values[4];

return 0;
}

5
After the last statement
After the array is After the first iteration After the loop is in the main method is
created in the loop is done completed executed

0 0 0 0

1 1 1 1

2 2 2 2

3 3 3 3

4 4 4 4

Part III:

Part III:

1. Write a function that finds the smallest element in an


array of integers using the following header:
double min(double array[], int size)

Write a test program that prompts the user to enter ten


numbers, invokes this function, and displays the minimum
value. Here is the sample run of the program:

<Output>

Enter ten numbers: 1.9 2.5 3.7 2 1.5 6 3 4 5 2

The minimum number is: 1.5

<End Output>

2. Write a function that counts the number of letters in


the string using the following header:
int countLetters(const char s[])

6
Write a test program that reads a C-string and displays the number of
letters in the string. Here is a sample run of the program:

<Output>

Enter a string: 2010 is coming

The number of letters in 2010 is coming is 8


<End Output>

7
Other documents randomly have
different content
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
back
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

testbankdeal.com

You might also like