stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
C Programming Flashcards | StudBud
Explore
/
C Programming
C Programming
30 terms
·
StudBud Administration
·
68 plays
A recap on C programming
Flashcards
30 cards
F
Practice quiz
P
Host live
L
Questions
30
Answers
1
Which
scanf()
statement will you use to scan a
float
value (
a
) and
double
value (
b
)?
scanf("%f %f", &a, &b);
scanf("%f %lf", &a, &b);
scanf("%lf % lf ", &a, &b);
scanf("%Lf %Lf", &a, &b);
2
What value of
x
,
y
and
z
makes
a=4
in a=( x > y ) ? (( x > z ) ? x : z) : (( y > z ) ? y : z )
6 5 3
3 4 2
5 4 5
6 3 5
3
What is the output of the following code?
Address of main function
Runtime Error
Some random value
Compiler Error
4
Which of the following is the correct operator to compare two variables
equals
=
==
:=
5
The keyword used to transfer control from a function back to the calling function is
switch
goto
return
go back
6
What is the output of the following code?
1
3
Garbage value
Compile time error
7
What is the output of the statement:
printf("%d",strcmp("strcmp()","strcmp()"));
Invalid use of strcmp() function
0
-1
1
8
What punctuation is used to signal the beginning and end of code blocks
( and )
--> and <--
Begin and End
{ and }
9
Which header file can be used to define
input/output
function prototypes?
memory.h
stdio.h
conio.h
math.h
10
Which of the following function is more appropriate for reading in a multi-word string?
scanf();
gets();
printf();
puts();
11
A local variable is stored in ___
Heap Segment
Code Segment
Stack Segment
None of the above
12
What is the output of the following program?
1 2
No Output
1
Compilation Error
13
If the two strings are identical, then
strcmp()
function returns
0
-1
Yes
1
14
What is the output of the following code?
9 7 5 3 1
Infinite Loop
9 8 7 6 5 4 3 2 1
9 7 5 3
15
What is the default value of an uninitialized global variable?
Garbage value
Address of the variable
0
1
16
What is the data type of ‘PI’ in
#define PI 3.141
Its float
Syntax error, semi colon is missing in the definition of PI
No type associated with PI, as it’s just a text substitution
Its double
17
Which of the following is not logical operator?
&&
&
||
!
18
What is the output of the following code?
Nothing gets printed
Outside Switch
Outside Case 1
Outside Case 2
19
Which of the following special symbol is allowed in a variable name?
| (pipeline)
* (asterisk)
- (hyphen)
_ (underscore)
20
What is the output of the statement:
printf("%d", !0<2);
1
True
0
False
21
What is the output of the following program?
main() { // Hello World }
Compile Error
RunTime Error
No Output
Garbage
22
Which statement can print
\n
on the screen?
printf("n");
printf('\n');
printf("n\");
printf("\\n");
23
which is the correct order of mathematical operations
Addition, Subtraction, Multiplication, Division
Addition, Division, Modulus, Subtraction
Division, Multiplication, Addition, Subtraction
Multiplication, Addition, Division, Subtraction
24
Consider the following variable declarations and Choose the correct statement
Both (i) and (ii) are valid
All are valid
Both (i) and (iii) are valid
Only (i) is valid
25
What is correct about the above program?
else block is executed
Unpredictable as i is not initialized
if block is executed
Error
26
Which of the following cannot be checked in a
switch-case
statement?
Float
Character
enum
Integer
27
We want to round off
x
, a
float
, to an
int
value, The correct way to do is
y = int(x + 0.5)
y = (int)((int)x + 0.5)
y = (int)x + 0.5
y = (int)(x + 0.5)
28
What punctuation ends a statement in C programming
: (colon)
; (semicolon )
, (comma)
. (dot)
29
If you assign a value to an array element whose subscript exceeds the size of array, then
Program may crash if some important data gets overwritten.
The array size would appropriately grow.
The element will be set to 0
The compiler would report an error.
30
Consider the below program fragment;
s2
will be executed if
b >= c and a <= b
a > b and b <= c
a <= b
b > c