cs201 Midterm Solved Quiz 1 Fall 2014
cs201 Midterm Solved Quiz 1 Fall 2014
30 PAGE 105-106
29
28
logical error
None of these
When the break statement is encountered in a loop‟s body, it transfers the control
________from the current loop.
Inside
To break statement
To continue statement
Brackets [] Lecture 11
char name [] = “Hello World” ; In the above statement, a memory of _______ characters
will be allocated
13
11
12 Lecture 12
10
A variable declared within a code block becomes ______ variable for that block.
Static
Integer
Local Lecture 9
Global
If we pass more than one arguments to a function then they are separated by
_________.
Comma , Lecture 9
Semicolon ;
Colon:
Brackets()
Switch support___
Integer
Character
None
Characters of a string stored in an array can be accessed directly using array _______.
Manipulation
Superscript
Postscript
A variable declared within a code block becomes ______ variable for that block.
Static
Integer
Local Lec 9
Global
Function data
Function arguments
Function name
If we pass more than one arguments to a function then they are separated by
Comma , Repeated
Colon :
Semicolon ;
From following; which one is the correct syntax of an array initialize: Array size is 10 and
it is of double data type to value 0?
arr[10] = {0.0};
Value Lec 9
Reference
Prototype
-1
0 Lec 11
Name
Data type
Value
Break Lec 9
Individual characters in a string stored in an array can be accessed directly using array
superscript
script
value
New line
Blank space
continue
break
goto
return Lec 9
From the following; which on is the correct syntax of an array declaration: array size is 5
and it is of float data type?
Select correct option:
float [5] name;
name[5] float;
float name[5];
None of the given options It will be float name[4];
Size
Data
From the following; which one is the range of Random number generator function
rand()?
Select correct option:
0 – 32768
1 – 32768
0 – 32767 Lec 10
1 – 32767
float array[15];
float[15] array;
float [15]array;
if ( i == 5)
continue;
2,3,7,8,
2,3,4,6,7,8,9
2,3,4
4,6,7,8,9
Value Repeated
Reference
Type
Data
logical error
None of these
Same Lecture 11
Different
What is the output of the following code, if the first case is true
switch (var)
case „a‟:
cout<<”apple”<<endl;
case „b‟:
cout<<”banana”<<endl;
case „m‟:
cout<<”mango”<<endl;
default:
cout<<”any fruit”<<endl;
apple
apple anyfruit
7 Lec 12
if
goto
continue
10
11
12 Lecture 12 (Repeated)
13
1- Return type of a function that does not return any value must be ________.
Char
Void Lecture 9
Int
void
Start
End PAGE 114
Begin
middle
""
()
{} Lecture 9
[]
4- What is the output of the following code, if the first case is true
switch(var) {
case „a‟:
cout”apple”endl;
case „m‟:
cout”mango”endl;
• Apple
• apple anyfruit
• apple banana mango anyfruit
• none of above Repeated
• 0 – 49 Lecture 11
• 1 – 49
• 0 – 50
• 1 – 50
• 999 Repeated
• 1000
• 1001
• 1002
9- If we pass more than one arguments to a function then they are separated by
___________.
• n-2
• n-1
• n+1
•n