In the following nested conditional statements, which branch will execute?
int x = 4;if (x > 2) { if (x < 5) { printf("x is between 2 and 5"); }} else { printf("x is 2 or less");}
x is between 2 and 5
x is 2 or less
Error
No output
print("Hello World");
echo("Hello World");
printf("Hello World");
None of these
C compiler supports octal integer constant.
C compiler supports hexadecimal integer constant.
C compiler supports binary integer constant.
C compiler supports decimal integer constant.
Compilation error
Program will terminate with an error
Undefined behavior
Array index will wrap around
printf("\n");
echo '\n';
printf('\n');
printf('\\n')
2
4
1
Depends on the system
int a(char *s)
void b(int a[], int n)
float *c()
short d(long x)
float
real
int
double
Moves the file pointer to a specific location
Reads a file
Writes to a file
Closes a file
immutable
mutable
const
volatile
char > int > float
int > char > float
char < int < double
double > char > int
function(int ptr);
function(int *ptr);
function(*ptr);
function(ptr *int);
Binary operator
Unary operator
Ternary operator
All of the above
scanf()
getch()
getche()
gets()
It returns the size of the variable in bits
It returns the size of the variable in bytes
It returns the size of the variable in kilobytes
It returns the number of elements in an array
break
exit(0)
abort()
All of the mentioned
Logical Operator
Conditional Operator
typecast
Ternary
An Editor
A compiler
An operating system
Martin Richards
Dennis Ritchie
Ken Thompson
Herman Hellorith
return
static
new
&&
| |
!
start()
printf()
main()
It exits the current loop and continues with the next iteration
It terminates the current loop and transfers control to the next statement after the loop
It skips the current iteration and moves to the next iteration
It repeats the current iteration
What will be output if you will compile and execute the following c code?
int main(){ int a=5; float b; printf("%d",sizeof(++a+b)); printf(" %d",a); return 0;}
2 6
4 6
2 5
4 5
getchar()
cin.get()
-5
0
+5
no of students
char
7th
myName
include
Addition, Division, Modulus
Addition, Modulus, Division
Multiplication, Substration, Modulus
Modulus, Multiplication, Substration
What will be output if you compile and execute the following ‘C’ code?
void main(){int i=4,x;x=++i + ++i + ++i;printf("%d",x);}
21
18
19
What will be the output of the following program?
int main() { int x=5; printf(“%d %d %d”,x,x<<2,x>>2); }
1 20 5
5 1 20
5 20 1
20 1 5
for loop
while loop
do-while loop
None of the above
-1
Depends on array size
ctype.h
stdio.h
conio.h
math.h
&
||
Infinitely
Variable
put together the file and functions that are required by the program
translate the instructions into a form suitable for execution by the program
load the executable code into the memory and execute them
allow the user to type the program
Find the output of following code :
int main() { int i=-2; printf (“-i=%d”,-i); return b; }
–i=2
i=-2
–i=-2
–i=+2
int number;
float rate;
int variable_count;
int $main;
ceil(1.66)
floor(1.66)
roundup(1.66)
roundto(1.66)
It is used to define global variables
It is used to define a macro
It is used to include standard or user-defined header files in the program
It is used to include comments in the code
continue
final
constant
They execute programs faster than compilers
They translate the entire program at once
They translate and execute code line by line
They are not used in modern programming
fclose()
closefile()
fileclose()
endfile()
<
=
>=
<=
4 Bytes
8 Bytes
Depends on the system/compiler
Cannot be determined
To determine which operator evaluated first from left to right.
To determine the level of an operator in a program.
To determine how an expression involving more than one operator is evaluated.
To check the expression is valid or not.