CCP MCQ
CCP MCQ
Variables
Constants
Variable names on right side of =
=Constants on left side of =
1----------------------------------------------
2-----------------------------------------------
3----------------------------------------------
4----------------------------------------------
5----------------------------------------------
6----------------------------------------------
7----------------------------------------------
An expression contains relational operators, assignment operators, and arithmetic operators. In the
absence of parentheses, they will be evaluated in which of the following order:
assignment, relational, arithmetic
=arithmetic, relational, assignment
relational, arithmetic, assignment
assignment, arithmetic, relational
8----------------------------------------------
In what sequence the initialization, testing and execution of body is done in a do-while loop
=Initialization, execution of body, testing
Execution of body, initialization, testing
Initialization, testing, execution of body
Testing, initialization, execution of body
9----------------------------------------------
for ( ; ; ) ;
int y, x = 0 ;
do{
y=x;
} while ( x == 0 ) ;
10----------------------------------------------
11----------------------------------------------
In C continue statement
=Without executing remaining statements take control back to starting loop
Take control outside of the loop
Continues to program end
Continues and break
12----------------------------------------------
13----------------------------------------------
14----------------------------------------------
The Algorithm represent in the form of programming language is __________
Flowchart
Pseudo code
=Program
Data Flow Diagram
15----------------------------------------------
16----------------------------------------------
17----------------------------------------------
18----------------------------------------------
19----------------------------------------------
=Only I is correct
Only II is correct
Both I & II are correct
Both I & II are incorrect
20----------------------------------------------
In case of a conflict between the names of a local and global variable what happens?
The global variable is given a priority.
=The local variable is given a priority.
Which one will get a priority depends upon which one is defined first.
The compiler reports an error.
21----------------------------------------------
For which of the following situation should the register storage class be used?
For local variable in a function
=For loop counter
For collecting values returned from a function
For variables used in a recursive function
22----------------------------------------------
23----------------------------------------------
What would happen if you assign a value to an element of an array whose subscript exceeds the size of
the array?
The element will be set to 0
Nothing, it’s done all the time
Other data may be overwritten
=Error message from the compiler
25----------------------------------------------
When you pass an array as an argument to a function, what actually gets passed?
=Base address of the array
Values of the elements of the array
Address of the first element of the array
Number of elements of the array
26----------------------------------------------
27----------------------------------------------
if int s[5] is a one-dimensional array of integers, which of the following refers to the third element in the
array?
=*( s + 2 )
*( s + 3 )
s+3
s+2
28----------------------------------------------
29----------------------------------------------
30----------------------------------------------
struct time
{
int hours ;
int minutes ;
int seconds ;
}t;
struct time *tt ;
tt = &t ;
Looking at the above declarations, which of the following
refers to seconds correctly:
tt.seconds
=( *tt ).seconds
time.t
tt -> seconds
31----------------------------------------
To receive the string "We have got the guts, you get the glory!!" in an array char str[100] which of the
following functions would you use?
32----------------------------------------
Which function would you use if a single key were to be received through the keyboard?
scanf( )
gets( )
=getche( )
getchar( )
33----------------------------------------
If an integer is to be entered through the keyboard, which function would you use?
=scanf( )
gets( )
getche( )
getchar( )
34----------------------------------------
35----------------------------------------
36----------------------------------------
10, 20
0, 20
20, 0
=Nothing
37----------------------------------------
=3, 5
3
5
None
38----------------------------------------
=0, 200
300, 200
300, 0
None
39----------------------------------------
=300, 0
0, 200
300, 200
None
40----------------------------------------
41----------------------------------------
=15 15 0
5 15 15
5 15 0
15 15 1