0% found this document useful (0 votes)
61 views11 pages

CCP MCQ

The document contains questions about C programming concepts like variables, data types, operators, control structures, functions etc. and their correct and incorrect usages based on C standards. The key points are: - Arithmetic instructions in C cannot contain variables, constants on the left side of =, or variable names on the right side of =. - The order of evaluation for expressions in C without parentheses is arithmetic, relational, assignment operators. - The initialization, testing, and execution order in a do-while loop is initialization, execution of body, testing. - A flowchart uses terminal symbols like a circle to indicate the end of a process.

Uploaded by

Nightmare King
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views11 pages

CCP MCQ

The document contains questions about C programming concepts like variables, data types, operators, control structures, functions etc. and their correct and incorrect usages based on C standards. The key points are: - Arithmetic instructions in C cannot contain variables, constants on the left side of =, or variable names on the right side of =. - The order of evaluation for expressions in C without parentheses is arithmetic, relational, assignment operators. - The initialization, testing, and execution order in a do-while loop is initialization, execution of body, testing. - A flowchart uses terminal symbols like a circle to indicate the end of a process.

Uploaded by

Nightmare King
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

In C, Arithmetic instruction cannot contain

Variables
Constants
Variable names on right side of =
=Constants on left side of =

1----------------------------------------------

Which of the following is FALSE in C?


=Keywords can be used as variable names
Variable names can contain a digit
Variable names do not contain a blank space
Capital letters can be used in variable names

2-----------------------------------------------

The expression x = 4 + 2 % - 8 evaluates to


-6
=6
4
None of the above

3----------------------------------------------

Which of the following is allowed in a C Arithmetic instruction


[]
{}
=( )
[ ] and ( ) only

4----------------------------------------------

The statement char ch = ‘Z’ would store in ch


The character Z
ASCII value of Z
Z along with the single inverted commas
=Both (1) and (2)

5----------------------------------------------

The maximum value that an integer constant can have is


-32767
=32767
1.7014e+38
–1.7014e+38

6----------------------------------------------

Which of the following statements is false


=Each new C instruction has to be written on a separate line
Usually all C statements are entered in small case letters
Blank spaces may be inserted between two words in a C statement
Blank spaces cannot be inserted within a variable name

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----------------------------------------------

Which of the following is not an infinite loop.


int i = 1 ;
while ( 1 )
{
i++ ;
}

for ( ; ; ) ;

=int True = 0, false ;


while ( True )
{
False = 1 ;
}

int y, x = 0 ;
do{
y=x;
} while ( x == 0 ) ;

10----------------------------------------------

In a flow chart terminal symbol indicates


=End
processing
input and output
decision

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----------------------------------------------

This of the following is not a basic control structure


The process
The decision
The loop
=The sequential

13----------------------------------------------

The flowchart and algorithms are used for


Better programming
Easy testing and debugging
Efficient coding
=All

14----------------------------------------------
The Algorithm represent in the form of programming language is __________
Flowchart
Pseudo code
=Program
Data Flow Diagram

15----------------------------------------------

What symbol is used to represent output of the flowchart?


Square
Circle
=Parallelogram
Triangle

16----------------------------------------------

What is the standard terminal symbol for flowchart?


=Circle
Parallelogram
Diamond
Square

17----------------------------------------------

Which of the following switch statement is legal?


switch ( i + j * k )
switch ( 23 + 45 % 4 * k )
switch ( a < 4 && b > 7 )
=All of above

18----------------------------------------------

We cannot do with a switch.


A float expression cannot be tested using a switch
Cases can never have variable expressions
Multiple cases cannot use same expressions.
=All of above

19----------------------------------------------

Which of the following statement are correct?


(i) The value stored in the CPU register can always be accessed faster than that stored in memory.
(ii) A register storage class variable will always be stored in a CPU register.

=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----------------------------------------------

A header file is:


A file that contains standard library functions
A file that contains definitions and macros
A file that contains user - defined functions
=A file that is present in current working directory

23----------------------------------------------

In a program the statement:


#include "filename"
is replaced by the contents of the file “filename”
=Before compilation
After Compilation
During execution
During run time
24----------------------------------------------

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----------------------------------------------

Which of the following is the correct way of declaring a float pointer?


float ptr ;
=float *ptr ;
*float ptr ;
None of the above

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----------------------------------------------

What would be the output of the following program?


int main( )
{
printf ( "%c", "abcdefgh"[4] ) ;
}
abcd
efgh
cdef
=None

29----------------------------------------------

What would be the output of the following program?


int main( )
{
printf ( 5 + "Good Morning " ) ;
}
Good Morning
Good
=Morning
None

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?

scanf ( "%s", str ) ;


=gets ( str ) ;
getche ( str ) ;
fgetchar ( str ) ;

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----------------------------------------

The format string of a printf( ) function can contain:


=Characters, format specifications and escape sequences
Character, integers and floats
Strings, integers and escape sequences
Inverted commas, percentage sign and backslash character

35----------------------------------------

A field width specifier in a printf() function


Specifies the maximum value of a number
Controls the size of type used to print numbers
Controls the margins of the program listing
=Specifies how many characters positions will be used for a number

36----------------------------------------

What would be the output of the following program?


int main( )
{
int x = 10, y = 20 ;
if ( x == y ) ;
printf ( "\n%d %d", x, y ) ;
}

10, 20
0, 20
20, 0
=Nothing

37----------------------------------------

What would be the output of the following program?


int main( )
{
int x = 3, y = 5 ;
if ( x == 3 )
printf ( "\n%d", x ) ;
else ;
printf ( "\n%d", y ) ;
}

=3, 5
3
5
None

38----------------------------------------

What would be the output of the following program?


int main()
{
int a = 300, b, c ;
if ( a >= 400 )
b = 300 ;
c = 200 ;
printf ( "\n%d %d", b, c ) ;
return 0;
}

=0, 200
300, 200
300, 0
None
39----------------------------------------

What would be the output of the following program?


int main()
{
int a = 500, b, c ;
if ( a >= 400 )
b = 300 ;
c = 200 ;
printf ( "\n%d %d", b, c ) ;
return 0;
}

=300, 0
0, 200
300, 200
None

40----------------------------------------

What would be the output of the following program?


int main()
{
int x=4,y,z;
y=--x;
z=x--;
printf("\n%d %d %d",x,y,z);
}
=2 3 3
4 3 3
4 3 2
2 3 2

41----------------------------------------

What would be the output of the following program?


int main()
{
int a = 5, b, c ;
b = a = 15 ;
c = a < 15 ;
printf ( "\na = %d b = %d c = %d", a, b, c ) ;
}

=15 15 0
5 15 15
5 15 0
15 15 1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy