NEW
Font size
WorksheetsC-Programming Basics
Total questions: 16
Worksheet time: 8mins
Which of the following correctly shows the hierarchy of arithmetic operations in C?
/ + * -
* - / +
+ - / *
/ * + -
To print out 'a' as an integer and 'b' as a decimal, which of the following printf() statement will you use?
printf("%f %lf", a, b)
printf("%f %f", a, b)
printf("%d %f", a, b)
printf("%f %d", a, b)
Which of the following is not logical operator?
&
&&
||
!
When does the code block following while(x<100) execute?
When x is less than one hundred
When x is greater than one hundred
When x is equal to one hundred
while it wishes
Input/output function prototypes and macros are defined in which header file?
conio.h
stdlib.h
stdio.h
dos.h
What is the output of this C code?
#include <stdio.h>
int main()
{
printf("Hello World! %d \n", x);
return 0;
}
Hello World! x;
Hello World! followed by a junk value
Compile time error
Hello World!
Which of the following is not a correct variable type?
int
real
float
char
Which of the following is the correct operator to compare two variables?
equal
=
:=
==
What is the correct value to return to the operating system upon the successful completion of a program?
1
0
-1
program do not return a value
What is the only function all C programs must contain?
start()
system()
main()
Program()
What punctuation is used to signal the beginning and end of code blocks?
{ }
-> and <-
BEGIN and END
( and )
The "\n" character does which of the following operations?
Double line spacing
Character deletion
Character backspace
Places cursor on the next line
Is the syntax for the following C statement correct?:
scanf("%d", input);
True
False
Which arithmetic operator in C returns the integer remainder of the result of dividing its first operand by its second?
%
/
\
*
The compiler ignores comments and they are not translated into machine language.
True
False
You can have more than one main function.
True
False
