Question 1 (0.5 points) A method is invoked by a _________ . Question 1 options:
ID: 3910323 • Letter: Q
Question
Question 1 (0.5 points)
A method is invoked by a _________ .
Question 1 options:
return statement
method header
method call
None of the above.
Save
Question 2 (0.5 points)
A method's changes to a variable that is passed-by-value do not affect the value of the original variable.
Question 2 options:
True
False
Save
Question 3 (0.5 points)
A program contains a copy of a static variable for each object that is instantiated.
Question 3 options:
True
False
Save
Question 4 (0.5 points)
A return type of is specified for a method that does not return a value.
Question 4 options:
nothing
null
void
None of the above.
Save
Question 5 (0.5 points)
A static variable represents class-wide information.
Question 5 options:
True
False
Save
Question 6 (0.5 points)
A variable that has not been initialized cannot be passed to a method.
Question 6 options:
True
False
Save
Question 7 (0.5 points)
A(n) conversion occurs when a type is converted to a type that can hold more data.
Question 7 options:
implicit
widening
explicit
None of the above.
Save
Question 8 (0.5 points)
An overloaded method is one that
Question 8 options:
has a different name as another method, but the same parameters.
has the same name as another method, but different parameters.
has the same name and parameters as a method defined in another class.
has the same name and parameters, but a different return type as another method.
Save
Question 9 (0.5 points)
Any variable declared with keyword const is a constant and cannot be changed after the constant is declared.
Question 9 options:
True
False
Save
Question 10 (0.5 points)
Any variables declared in a for structure header have block scope within that structure.
Question 10 options:
True
False
Save
Question 11 (0.5 points)
C# will attempt to perform conversions that do not result in data loss implicitly.
Question 11 options:
True
False
Save
Question 12 (0.5 points)
How are various parameters separated in the method header?
Question 12 options:
brackets
braces
commas
periods
Save
Question 13 (0.5 points)
Identifiers declared within a class have .
Question 13 options:
block scope
class scope
local scope
None of the above.
Save
Question 14 (0.5 points)
If a local variable in a method has the same name as a variable in the main program, what will occur?
Question 14 options:
an error is generated
the variable in the main program is "hidden" until the method is finished executing
the variable in the main program will override the variable from the method
None of the above.
Save
Question 15 (0.5 points)
Information may be _______ methods.
Question 15 options:
passed to
returned from
manipulated in
All of the above.
Save
Question 16 (0.5 points)
Let there be method called Function which takes 3 parameters of type bool. Which of the following method headers could it represent?
Question 16 options:
Funtion(bool a, bool b, bool c)
Function()
All of the above
None of the above
Save
Question 17 (0.5 points)
Let x be a double. How can you typecast a double into a float?
Question 17 options:
implicitly
x(float)
(float)x
x = float
Save
Question 18 (0.5 points)
Methods are called by writing the name of the method followed by __________ enclosed in parentheses.
Question 18 options:
a condition
arguments
a counter
None of the above.
Save
Question 19 (0.5 points)
_________ methods can be called without the need for an object of the class to exist.
Question 19 options:
special
independent
static
dependent
Save
Question 20 (0.5 points)
Methods can return at most one value.
Question 20 options:
True
False
Save
Question 21 (0.5 points)
Methods of a class can access all members defined in that class.
Question 21 options:
True
False
Save
Question 22 (0.5 points)
Methods of the same name can be declared in the same class, as long as they have different sets of parameters (determined by the number, types and order of the parameters).
Question 22 options:
True
False
Save
Question 23 (0.5 points)
Methods should be large and perform as many tasks as possible.
Question 23 options:
True
False
Save
Question 24 (0.5 points)
Methods that call themselves are known as ________.
Question 24 options:
reiterative
self-calling
repeat-calling
recursive
Save
Question 25 (0.5 points)
Overloaded methods always have the same _________.
Question 25 options:
method name
return type
number of the parameters
order of the parameter
Save
Question 26 (0.5 points)
Passing an argument to a method by-value provides the method with:
Question 26 options:
the address of the value in memory
a separate copy of the value
the type of the value
None of the above.
Save
Question 27 (0.5 points)
Programmers write ________ to define specific tasks that may be used at many points in a program.
Question 27 options:
classes
methods
modules
None of the above.
Save
Question 28 (0.5 points)
Stacks are _____________ data structures.
Question 28 options:
FIFO
Random
LIFO
None of the above.
Save
Question 29 (0.5 points)
Suppose method1 is declared as
void method1 ( int a, float b )
Which of the following methods overloads method1?
Question 29 options:
void method2 ( int a, float b )
void method2 ( float a, int b )
void method1 ( float a, int b )
void method1 ( int b, float a )
Save
Question 30 (0.5 points)
The keyword is used to pass value-type variables to methods by-reference.
Question 30 options:
ref
reference
RefPass
None of the above.
Save
Question 31 (0.5 points)
The parameter list in the method header and the arguments in the method call must agree in:
Question 31 options:
number
type
order
all of the above
Save
Question 32 (0.5 points)
The return type of a method's return value is specified in the method call.
Question 32 options:
True
False
Save
Question 33 (0.5 points)
To access the class's non-static members, a static method must use a reference to an object of the class.
Question 33 options:
True
False
Save
Question 34 (0.5 points)
To call a static method, use the _________ name followed by a period, and the method with its arguments.
Question 34 options:
class's
instance variable's
namespace's
All of the above
Save
Question 35 (0.5 points)
What is pushed onto the program execution stack when a method is call?
Question 35 options:
the whole method
the class of the method being called
the object of method being called
the return address of the method being called
Save
Question 36 (0.5 points)
Which of the following correctly calls the Math class method Sqrt with a value of 36?
Question 36 options:
Sqrt(36);
Math.Sqrt(36);
Math.Sqrt = 36;
None of the above.
Save
Question 37 (0.5 points)
Which of the following describes a static variable?
Question 37 options:
a variable with one copy shared by all class objects
a variable whose value may not be changed
all of the above
None of the above.
Save
Question 38 (0.5 points)
Which of the following will violate the rules of overloading methods?
Question 38 options:
Methods with the same signatures but different return types.
Methods with different signatures but the same return type.
Methods with different number of arguments.
Method with different types of arguments.
Save
Question 39 (0.5 points)
Which of these statements best defines scope?
Question 39 options:
Scope refers to the classes that have access to a variable.
Scope determines whether a variable's value can be altered.
Scoping allows the programmer to use a class without using its fully qualified name.
Scope is the portion of a program that can refer to an entity by its simple name.
Save
Question 40 (0.5 points)
A constant must be initialized in the same statement where it is declared and cannot be modified.
Question 40 options:
True
False
Save
Question 41 (0.5 points)
A programmer must do the following before using an array:
Question 41 options:
declare then reference the array
create then declare the array
create then reference the array
declare then create the array
Save
Question 42 (0.5 points)
An array can be supplied values upon declaration by providing an .
Question 42 options:
initializer list
index
array allocation
None of the above.
Save
Question 43 (0.5 points)
An array is a group of contiguous memory locations that all have the same data type.
Question 43 options:
True
False
Save
Question 44 (0.5 points)
An array must be declared and allocated in the same statement.
Question 44 options:
True
False
Save
Question 45 (0.5 points)
Arrays are allocated with the keyword .
Question 45 options:
new
array
mem
None of the above.
Save
Question 46 (0.5 points)
Arrays are data structures consisting of data items of different types.
Question 46 options:
True
False
Save
Question 47 (0.5 points)
Arrays are not limited to just simple types, but can hold reference types as well.
Question 47 options:
True
False
Save
Question 48 (0.5 points)
Arrays are only designed to hold primitive data types and Strings.
Question 48 options:
True
False
Save
Question 49 (0.5 points)
Arrays can be declared to hold only primitive data types.
Question 49 options:
True
False
Save
Question 50 (0.5 points)
Arrays may have _______ dimensions.
Question 50 options:
one
two
more than two
All of the above.
Save
Question 51 (0.5 points)
Arrays remain the same size once they are created.
Question 51 options:
True
False
Save
Question 52 (0.5 points)
Attempting to access an array element out of the bounds of an array, a(n) ______ occurs.
Question 52 options:
ArrayOutOfBoundsException.
ArrayElementOutOfBoundsException.
IndexOutOfRangeException.
ArrayException.
Save
Question 53 (0.5 points)
By convention, the first set of brackets of a two-dimensional array identifies an element's column and the second identifies the row.
Question 53 options:
True
False
Save
Question 54 (0.5 points)
C# automatically performs bounds checking to ensure the program doesn't access data outside the bounds of an array.
Question 54 options:
True
False
Save
Question 55 (0.5 points)
Changes made to an entire array that has been passed to a method will not affect the original values of the array.
Question 55 options:
True
False
Save
Question 56 (0.5 points)
Consider array items, which contains the values 0, 2, 4, 6 and 8. If method changeArray is called with the method call changeArray( items, items[ 2 ] ), what values are stored in items after the method has finished executing?
public static void ChangeArray( int[] passedArray, int value )
{
passedArray[ value ] = 12;
value = 5;
} // end method ChangeArray
Question 56 options:
0, 2, 5, 6, 12
0, 2, 12, 6, 8
0, 2, 4, 6, 5
0, 2, 4, 6, 12
Save
Question 57 (0.5 points)
Consider integer array values, which contains 5 elements. Which statements successfully swap the contents of the array at index 3 and index 4?
Question 57 options:
values[ 3 ] = values[ 4 ];
values[ 4 ] = values[ 3 ];
values[ 4 ] = values[ 3 ];
values[ 3 ] = values[ 4 ];
int temp = values[ 3 ];
values[ 3 ] = values[ 4 ];
values[ 4 ] = temp;
int temp = values[ 3 ];
values[ 3 ] = values[ 4 ];
values[ 4 ] = values[ 3 ];
Save
Question 58 (0.5 points)
Consider the array:
s[ 0 ] = 7
s[ 1 ] = 0
s[ 2 ] = -12
s[ 3 ] = 9
s[ 4 ] = 10
s[ 5 ] = 3
s[ 6 ] = 6
The value of s[ s[ 6 ] - s[ 5 ] ] is:
Question 58 options:
0
3
9
0
Save
Question 59 (0.5 points)
Consider the class below:
public class Test
{
public static void Main( String[] args )
{
int[] a;
a = new int[ 10 ];
for ( int i = 0; i < a.Length; i++ )
a[ i ] = i + 1 * 2;
int result = 0;
for ( int i = 0; i < a.Length; i++ )
result += a[ i ];
Console.WriteLine( "Result is: {0}", result );
} // end Main
} // end class Test
The output of this C# program will be:
Question 59 options:
Result is: 62
Result is: 64
Result is: 65
Result is: 67
Save
Question 60 (0.5 points)
Consider the class below:
public class Test
{
public static void Main( String[] args )
{
int[] a = { 99, 22, 11, 3, 11, 55, 44, 88, 2, -3 };
int result = 0;
for ( int i = 0; i < a.Length; i++ )
{
if ( a[ i ] > 30 )
result += a[ i ];
} // end for
Console.WriteLine( "Result is: {0}", result );
} // end Main
} // end class Test
The output of this C# program will be:
Question 60 options:
Result is: 280
Result is: 154
Result is: 286
Result is: 332
Save
Question 61 (0.5 points)
Consider the code segment below. Which of the following statements is not true?
int[] g;
g = new int[ 23 ];
Question 61 options:
The first statement declares an array reference.
The second statement creates the array.
g is a reference to an array of integers.
The value of g[ 3 ] is -1.
Save
Question 62 (0.5 points)
Constants are usually denoted by variable names in all capital letters.
Question 62 options:
True
False
Save
Question 63 (0.5 points)
Each reference in an array of references is pointed to null by default when the array is allocated.
Question 63 options:
True
False
Save
Question 64 (0.5 points)
If you want to pass an array element into a method by reference, what will you need to do?
Question 64 options:
It always passes the element as a reference automatically.
Use the keyword ref and/or out.
All of the above.
None of the above, passing in by reference of an array element is only possible if the array type is a reference type.
Save
Question 65 (0.5 points)
In rectangular array items, which expression below retrieve the value at row 3 and column 5?
Question 65 options:
items[ 3 ].[ 4 ]
items[ 3[ 4 ] ]
items[ 3 ][ 4 ]
items[ 3, 4 ]
Save
Question 66 (0.5 points)
Individual elements of arrays are passed to methods by value.
Question 66 options:
True
False
Save
Question 67 (0.5 points)
Jagged arrays are maintained as arrays of arrays.
Question 67 options:
True
False
Save
Question 68 (0.5 points)
Local variables can be implicitly typed by replacing their type with keyword ______.
Question 68 options:
type
unk
dim
var
Save
Question 69 (0.5 points)
Multi-dimensional arrays require two or more indices to identify particular elements.
Question 69 options:
True
False
Save
Question 70 (0.5 points)
One could iterate through multi-dimensional arrays by using nested for loops.
Question 70 options:
True
False
Save
Question 71 (0.5 points)
Rectangular arrays are often used to represent tables of values consisting of information arranged in:
Question 71 options:
rows
columns
both a and b
None of the above
Save
Question 72 (0.5 points)
Suppose that class Book has been defined. Which set of statements creates an array of Book objects?
Question 72 options:
Book[] books;
books = new Book[ numberElements ];
Book[] books;
books = new Book()[ numberElements ];
new Book() books[];
books = new Book[ numberElements ];
All of the above.
Save
Question 73 (0.5 points)
Tables are often represented with rectangular arrays.
Question 73 options:
True
False
Save
Question 74 (0.5 points)
The first element in every array is the 0th element.
Question 74 options:
True
False
Save
Question 75 (0.5 points)
The foreach repetition structure requires the programmer provide an array and a variable for the purpose of:
Question 75 options:
preventing the structure from going past the end of the array
storing the value of each element that is traversed
acting as a counter to traverse the array
None of the above.
Save
Question 76 (0.5 points)
The foreach repetition structure is a simple structure used to traverse an array.
Question 76 options:
True
False
Save
Question 77 (0.5 points)
The foreach repetition structure is useful when the indices of the elements in an array are not important.
Question 77 options:
True
False
Save
Question 78 (0.5 points)
The keyword _______ overrides an existing method with the same signature.
Question 78 options:
replace
override
overrule
supersede
Save
Question 79 (0.5 points)
The number positioned in square brackets after an array name is the _______ of an item.
Question 79 options:
value
index
size
None of the above.
Save
Question 80 (0.5 points)
The params modifier can be used anywhere in the method's header.
Question 80 options:
True
False
Save
Question 81 (0.5 points)
There are two types of multidimensional arrays:
Question 81 options:
quadrangular and rectangular
rectangular and jagged
quadrangular and jagged
None of the above
Save
Question 82 (0.5 points)
Variable-length argument lists allow you to create methods that receive an arbitrary number of arguments.
Question 82 options:
True
False
Save
Question 83 (0.5 points)
What is the keyword associated with variable-length argument lists?
Question 83 options:
arg
params
var
val
Save
Question 84 (0.5 points)
What is the proper foreach header format?
Question 84 options:
( foreach type_identifer in arrayName )
foreach ( arrayName )
foreach ( type_identifer in arrayName )
None of the above.
Save
Question 85 (0.5 points)
When dealing with multi-dimensional arrays, each "row" must be the same size.
Question 85 options:
True
False
Save
Question 86 (0.5 points)
When values are provided upon declaration of an array, the new keyword is not required.
Question 86 options:
True
False
Save
Question 87 (0.5 points)
Which foreach header represents iterating through an array of int named numbers?
Question 87 options:
foreach ( numbers )
foreach ( number in numbers )
foreach ( int number in numbers )
foreach ( int number in int[] numbers )
Save
Question 88 (0.5 points)
Which method call does the method header void ModifyArray(double[] b) represent? Assume that the array being passed in is already defined and is called list.
Question 88 options:
ModifyArray( double[] list )
ModifyArray( double[] : list )
ModifyArray( double list[] )
ModifyArray( list )
Save
Question 89 (0.5 points)
Which of the following correctly accesses the 13th element of array Book?
Question 89 options:
Book[0] + 13
Book[13]
Book[12]
None of the above.
Save
Question 90 (0.5 points)
Which of the following statements about arrays are true?
A: Arrays are a group of variables that all have the same type.
B: Elements are located by index or subscript.
C: The length of an array c is determined by the expression c.Length.
D: The zeroth element of array c is specified by c[ 0 ].
Question 90 options:
A, C, D.
A, B, D.
C, D.
A, B, C, D.
Save
Question 91 (0.5 points)
Which of the following correctly declares and allocates an array of double values?
Question 91 options:
double A[15];
double() A = new double[15];
double[] A = new double[25];
All of the above.
Save
Question 92 (0.5 points)
Which of the following initializer lists would correctly set the elements of array n?
Question 92 options:
int[] n = { 1, 2, 3, 4, 5 };
array n[ int ] = { 1, 2, 3, 4, 5 };
int n[ 5 ] = { 1; 2; 3; 4; 5 };
int n = new int( 1, 2, 3, 4, 5 );
Save
Question 93 (0.5 points)
Which of the following will not produce a compiler error?
Question 93 options:
Changing the value of a constant after it is declared.
Changing the value at a given index of an array after it is created.
Using a final variable before it is initialized.
All of the above will produce compiler errors.
Save
Question 94 (0.5 points)
Which of the following correctly declares and initializes a two-dimensional array of integers?
Question 94 options:
int[,] sum = new int[3, 4];
int[] sum = new int[2, 4];
int sum[] = new int[2, 2];
None of the above.
Save
Question 95 (0.5 points)
Which of the following statements creates a multidimensional array with 3 rows, where the first row contains 1 value, the second row contains 4 items and the final row contains 2 items?
Question 95 options:
int[][] items = { new int { 1, null, null, null },
new int { 2, 3, 4, 5 },
new int { 6, 7, null, null } };
int[][] items = { new int { 1 },
new int { 2, 3, 4, 5 },
new int { 6, 7 } };
int[][] items = { new int { 1 },
new int { 2, 3, 4, 5 },
new int { 6, 7 },
new int {} );
int[][] items = { new int { 1 },
new int { 4 },
new int { 2 } };
Save
Question 96 (0.5 points)
Which of the following sets of statements creates a multidimensional array with 3 rows, where the first row contains 1 value, the second row contains 4 items and the final row contains 2 items?
Question 96 options:
int[][] items;
items = new int[ 3 ][ ? ];
items[ 0 ] = new int[ 1 ];
items[ 1 ] = new int[ 4 ];
items[ 2 ] = new int[ 2 ];
int[][] items;
items = new int[ 3 ][ ];
items[ 0 ] = new int[ 1 ];
items[ 1 ] = new int[ 4 ];
items[ 2 ] = new int[ 2 ];
int[][] items;
items = new int[ ? ][ ? ];
items[ 0 ] = new int[ 1 ];
items[ 1 ] = new int[ 4 ];
items[ 2 ] = new int[ 2 ];
int[][] items;
items[ 0 ] = new int[ 1 ];
items[ 1 ] = new int[ 4 ];
items[ 2 ] = new int[ 2 ];
Save
Question 97 (0.5 points)
Which set of statements totals the items in each row of two-dimensional array items, and displays each total?
Question 97 options:
int total = 0;
for ( int row = 0; row < items.Length; row++ )
{
total = 0;
for ( int column = 0; column < a[ row ].Length; column++ )
total += a[ row ][ column ];
}
int total = 0;
for ( int row = 0; row < items. Length; row++ )
{
for ( int column = 0; column < a[ row ]. Length; column++ )
total += a[ row ][ column ];
}
int total = 0;
for ( int row = 0; row < items. Length; row++ )
{
for ( int column = 0; column < a[ column ].length; column++ )
total += a[ row ][ column ];
}
int total = 0;
for ( int row = 0; row < items. Length; row++ )
{
total = 0;
for ( int column = 0; column < a[ column ].length; column++ )
total += a[ row ][ column ];
}
Save
Question 98 (0.5 points)
Which statement below initializes array items to contain 3 rows and 2 columns?
Question 98 options:
int[,] items = { { 2, 4 }, { 6, 8 }, { 10, 12 } };
int[,] items = { { 2, 6, 10 }, { 4, 8, 12 } };
int[,] items = { 2, 4 }, { 6, 8 }, { 10, 12 };
int[,] items = { 2, 6, 10 }, { 4, 8, 12 };
return statement
method header
method call
None of the above.
Explanation / Answer
Answer)
1) c) Method Call
Please note: As per Chegg policy, if any question has multiple questions then a minimum of one question can be answered. If you wish to get all the answers please help to re-post the same in separate questions instead of down rating the same.