Font size
WorksheetsC Programming Quiz
Total questions: 87
Worksheet time: 1hrs 1mins
Which of the following is true for variable names in C
Variable names cannot start with a digit
Variable can be of any length
They can contain alphanumeric characters as well as special characters
Reserved Word can be used as variable name
Which of these is NOT a relational or logical operator?
=
||
==
!=
What is the scope of an external variable?
Whole source file in which it is defined
From the point of declaration to the end of the file in which it is defined
Any source file in a program
From the point of declaration to the end of the file being compiled
The global variables are ____________.
External
internal
both A & B
None
The #include
Inclusion directive
File inclusion directive
Preprocessor directive
None of the above
Which of these properties of #define is false?
These always obey the scope rules
We can make use of a pointer to #define
The #define can be externally available
All of the above
Pick the correct syntax for Ternary Operator in C from the options given below:
condition < expression1 ? expression2
condition ? expression1 < expression2
condition : expression1 ? expression2
condition ? expression1 : expression2
Find the output of the given C statement. void main(){ int p=0; p = 5<2 ? 4 : 3; printf("%d",p); }
2
5
3
4
Find a C Storage Class below
static
auto
register & extern
All the above
How many keywords are there in C Language?
30
22
32
36
Identify wrong C keyword below
auto, double, int, struct
break, else, long, switch
case, enum, register, typedef
char, extern, intern, return
Which of the following bitwise operators works best for turning a particular off in any given number?
& operator
&& operator
! operator
|| operator
Each statement in a C program should end with?
;
:
.(dot symbol)
None of the above
What is the 16-bit compiler allowable range for integer constants?
-3.4e38 to 3.4e38
-32767 to 32768
-32668 to 32667
-32768 to 32767
The size of char is 1 byte when the char is:
Signed
Unsigned
Both
None
The range and size of a data type range between various:
Compilers
Operating Systems
Both
None
For which type, the format specifier "%i" is used?
int
char
float
double
Which is correct with respect to the size of the data types in C?
char > int > float
char < int < float
int < char < float
int < chat > float
Which of the following typecasting is accepted by C?
Widening conversions
Narrowing conversions
Widening & Narrowing conversions
None of the mentioned
Which type of conversion is NOT accepted?
From char to int
From float to char pointer
From negative int to char
From double to char
Decision making in the C programming language is
(a)
What will be the output of the following C code? int main(){ printf((43 > 43) ? "value 1 is greater!" : "value 1 is not greater!");}
value 1 is greater!
value 1 is not greater!
What will be the result of - (! (25 > 25))
(a)
C language was invented in which laboratories?
(a)
What is an Identifier in C Language.?
An Identifier can start with?
(a)
A Variable of a particular type can hold only a constant of the same type
(a)
Number of Keywords present in C Language are
(a)
Each statement in a C program should end with
(a)
Types of Real numbers in C are
(a)
Sizes of short, int and long in a Turbo C C++ compiler in bytes are
(a)
In an integer, left most bit 0 in Signed representation indicates
(a)
Default storage class of a variable is
(a)
Evaluate int a = 12 + 3 * 5 / 4 -10
(a)
Evaluate int a=10+ 4.867
(a)
Out of the following, which one is not valid as an if-else statement?
if ((char) x){}
if (x){}
if (func1 (x)){}}
if (if (x == 1)){}
We cannot use the keyword 'break' simply within _________.
while
for
if-else
do-while
In C, what is the purpose of the 'goto' statement?
Break out of a loop
Terminate the program
Transfer control to a labeled statement
Execute a function
Which loop is faster in C Language, for, while or Do While
for
while
do-while
All work same speed
What is the output of C Program void main(){ int a=5; while(a=12){ printf("RCEE"); break; }
ster in C Language, for, while or Do While
A. for
B. while
C. do-while
D. All work same speed
What is the output of C Program void main(){ int a=5; while(a=12){ printf("RCEE"); break; } printf("Eluru");}
A. RCEE
B. Eluru
C. RCEEEluru
D. Compile error
How many times RCEE is printed? main(){ while(1){ printf("RCEE"); } }
A. One time
B. Infinite Times
C. Compile error
D. Runtime error
How many times the following code prints the string "hello" for(i=1;i<=50;i++) printf("Hello");
A. 1
B. 50
C. 0
D. None of them
A labeled statement consist of an identifier followed by
A. ;
B. :
C. ,
D. =
How many loops are there in C
A.2
B. 3
C. 4
D. 1
What will be the output of the following piece of code?
#include
A. CSERCEE
B. RCEE
C. complier error
D. None of these
Choose facts about continue; statement is C Language
A. continue; is used to take the execution control to next iteration or sequence
B. continue; statement causes the statements below it to skip for execution
C. continue; is usually accompanied by IF statement.
D. All the above.
Choose a correct statement about C break; statement.
A. break; statement can be used inside switch block
B. break; statement can be used with loops like for, while and do while.
C. break; statement causes only the same or inner loop where break; is present to quit suddenly.
D. All the above.
Choose a correct statement about C language break; statement
A. A single break; statement can force execution control to come out of only one loop.
B. A single break; statement can force execution control to come out of a maximum of two nested loops.
C. A single break; statement can force execution control to come out of a maximum of three nested loops.
D. None of the above.
Choose a correct C Statement regarding for loop. for(; ;)
A. for loop works exactly first time
B. for loop works infinite number of times
C. Compiler error
D. None of the above.
Expand or Abbreviate ASCII with regard to C Language
A. Australian Standard Code for Information Interchange
B. American Standard Code for Information Interchange
C. American Symbolic Code for Information Interchange
D. Australian Symbolic Code for Information Interchange
What is the output of C Program with switch statement or block int main(){ int a=3; switch(a){ } printf("RCEE");}
A. RCEE
B. No Output
C. Compile Error
D. Runtime Error
What is the output of C Program with switch statement or block int main(){ int a; switch(a){ printf("APACHE "); } printf("HEROHONDA");}
A. APACHE HEROHONDA
B. HEROHONDA
C. No Output
D. Compiler error
Which of the following statement about for loop is true?
A. Index value is retained outside the loop
B. Index value can be changed from within the loop
C. Goto can be used to jump, out of the loop
D. All of these
What will be the output if you will compile and execute the following C code void main(){ if(printf("RCEE")) printf("Eluru"); else printf("WG");}
A. Eluru
B. WG
C. RCEEEluru
D. Compiler Error
Which of the following is true
A. The body of a while loop is executed at least once
B. The body of a do-while loop is executed at least once
C. The body of a do-while loop is executed zero or more times
D. A for loop can never be used in place of a while loop
The if statement is a conditional statement? (True/False)
(a)
When the condition of if statement is false, the flow of code will (a)
Can the else statement exist without the if statement in C?
(a)
The if-else if-else statement in C programming is used?
(a)
How many expressions can be checked using if...elseif...else statement?
(a)
Multiple values of the same variable can be tested using (a) .
When all cases are unmatched which case is matched in a switch statement?
(a)
Loops in C programming are used to (a) .
What will happen if the loop condition will never become false?
(a)
When all parts of the for loop are eliminated, what will happen?
(a)
Can a loop be nested in C programming?
(a)
Which loop executes the block a specific number of times?
(a)
If block always need to be associated with an else block?
(a)
The conditional operator are also known as
If you have to make decision based on multiple choices, the best suited loop is
(a)
The continue statement cannot be used with (a)
What will be the value of y if x = 8? y=(x>6 ? 4 : 6) ans:
(a)
Name the operator reverses the result of expression it operators on
goto can be used to jump from main to within a function?
(a)
Switch statement does not accept which values to its case labels
(a)
Which loop is guaranteed to execute at least one time
(a)
A labeled statement consists of an identifier followed by
(a)
do-while loop terminates when conditional expression returns?
(a)
For loop in a C program, if the condition is missing?
How long the following loop runs? for( i=1; i=3;i++)
In ___loop fusion____, the bodies of the two loops are merged together to form a single loop provided that they do not make any references to each other.
(a)
A switch statement is used to To choose from multiple possibilities based on a variable
(a)
If switch is present then default label must be presented
(a)
Given b = 110 and c = 20, what is the value of 'a' after execution of the expression a = b = c*=5?
(a)
What is the use of the size() operator?
