Exam Com Prog Sample

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

1.) is a collection of data that are referred to by a common name.

a.) Array b.) Set C.) Structure

2.) The data in an array can be stored as ________ and ___________


a.) Homogeneous and Heterogeneous b.) Text and numbers c.) Memory and locations

3.) C++ only supports ________ arrays.


a.) Homogeneous b.) Heterogenous c.) Both

4.) Arrays can be ____ arrays.


a.) One-dimensional b.) Two-dimensional c.) Multi-dimensional

5.) __________ refers to the individual data or value in the array.

a.) Element b.) Index C.) Variable

6.) __________ is used to access specific element in the array.


a.) Element b.) Index C.) Variable

7.) 2.5 1.25 3.5 2.0 5.0, which index position is 3.5?
a.) 2 b.) 1 c.) 0

8.) _________ is an array having a single index value to represent the array elements.

a.) One-dimensional array b.) Two-dimensional array c.) Multi-dimensional array

9.) What should be the array size?


a.) Positive integer b.) An integer either positive or negative c.) Whole number

10.)type array_name[array_size]; which syntax is this for?


a.) One-dimensional array b.) Two-dimensional array c.) Multi-dimensional array

11.)In C++, indexes should be a non-negative integer with zero as the index of the first element in
the array and one less than the size of the array (n-1) as the index of the last element.
a.) non-negative integer, zero, one less, (n-1)
b.) any integer, zero, zero loss, (n-0)

12.) The syntax to access an element in the array is


a.) array_name[indices]
b.) array_name[index]

13.) _______ happens when you assign a value to a variable in the same statement in which you
declare that variable.
a.) Initialization b.) Declaration c.) Assignment
14.) type array_name[array_size]={element1, element2, … , element}; is the syntax for initializing a
____________

a.)one-dimensional array b.) multi-dimensional array

15.)The syntax for initializing a one-dimensional array is similar to the declaration except that it is
followed by the _____ and the _____
a.) assignment operator ( = ) and a comma-separated list of values b.) equal sign and dot-
operator
16.) double arr[5]={1.5, 2.0, 2.5, 3.0, 5.0};
int score[3] = { 74, 87, 91, 93 };

char ch[5] = {‘H’,’E’,’L’,’L’,’O’, ‘O’};

float x[] = { 44.4,, 22.3, 11.6, 33.3};

which produces an error?

a.) first, second, and last b.) first, second, third, and last c.) second, third and last

17.)________ can also be omitted in the array initialization.


a.) Array size b.) Array c.) Array of any types

18.)Arrays are usually processed with ___ loop.


a.) for b.) do-while c.) while

19.)Arrays cannot be _____ and cannot _______ to other arrays.


a.) assigned and initialize b.) assigned and operated
20.)If your array is out-of-bounds, it will produce an ______________
a.) abnormal program termination run-time error. b.) run-time error c.) out-of-bounds
21.)__________ is a sequence of characters enclosed in double quotes.
a.) Strings b.) Char
22.)String data are usually referred to as _______
a.) Sting literals b.) string c.) string literals
23.)C++ does not produce this certain data type.
a.) String b.) Boolean c.) Function
24.)If you wish to get space as part of your input, use the _____ command.
a.) gets b.) puts c.) cin
25.)Gets and puts came from what standard in/output library?
a.) studio.h b.) stdio.h c.) unistd.h
26.)The <stdio.h> provides a library for printing string ___ and getting string inputs ___.
a.) put and gets b.) puts and gets c.) gets and puts
27.) are algorithms that arranges data in some particular order such as ascending or
descending.
a.) Program codes b.) Sorting c.) Arranging
28.) ________ referred to as a table or matrix consisting of both rows and columns.
a.) one-dimensional array b.) two-dimensional array c.) multi-dimensional array
29.)The simplest form of multidimensional array is the ________
a.) one-dimensional array b.) two-dimensional array c.) multi-dimensional array
30.)There are two ways of mapping arrays:
a.) row major order and the column major order b.) column major order and the row major
order
31.)C/C++ uses a for the mapping.
a.) row major order b.) column major order
32.)Here is an example of a two-dimensional array code fragment: identify its parts
A[2][3]
a.) A refers to the array name, 2 refers to the row and 3 as its columns
b.) A refers to the array, 2 and 3 refers to max data storage.
33.)Initialization of a two dimensional array can be done in the same way as the one dimensional
array initializations except that braces are nested to specify the elements in second dimension.
a.) braces, nested b.) curly braces, declared in one line
34.)is a structure used to store data that can be represented as a rectangular grid of numbers.
a.) Matrix b.) matrices

35.)______ is a collection of variables referenced under one name, providing a convenient means of
keeping related information together.

a.) classes b.) structures c.) syntax


36.) ________ forms a template that may be used to create structure objects (that is, instances ofa
structure).
a.) structure declaration b.) declaration of structure
37.) The variables that make up the structure are called
a.) members b.) club members c.) index
38.)Other names for structure members are:
a.) elements and/or fields b.) index/members
39.)Keyword for structure is
a.) struct b.) structure c.) class
40.)General form of a structure declaration is
a.) struct struct-type-name {
type member-name;
type member-name;

type member-name;

.. .
} structure-variables;

b.) addr struct-type-name {


data member-name;
data member-name;
data member-name;

.. .
} structure-variables;
41.)Individual members of a structure are accessed through the use of the
a.) Dot operator b.) Index c.) Initializer
42.)The general form for accessing a member of a structure is
a.) structure-name.member-name. b.) structure-.member.
43.)What rules of initialization does structure follow?
a.) Initialization of array b.) Variable initialization
44.)What string operation can we use to assign a new value to a member in a structure?
a.) stcrcpy b.) strlen
45.)Structures can be declared as blank also.
a.) array b.) structures within a structure
46.)You can pass the entire structure as a function argument just like the way you pass any other
variable or pointer. You can also create a function that returns a structure type.
a.) function argument and structure type b.) function and value c.) variable and value
47.) _______ models real world objects.
a.) Object-oriented approach b.) Attributes
48.)______ in real world corresponds to data in a program.
a.) Attribute b.) Object C.) Classes
49.)_____ are something a real world object does in response to a stimulus or an event.
a.) Behaviors b.) Classes
50.)______ is created that serves as a template of the similar objects.
a.) Class B.) Objects
51.)______ are blueprints of objects.
A.) Class B.) Objects
52.)class ClassName

class body
}; is the syntax for :
a.) class b.) structure c.) arrays

Test ii

Write the syntax for array, structure and class.

You might also like