NEW
Font size
WorksheetsC Questions for BCA & BSc
Total questions: 30
Worksheet time: 10mins
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
What will happen when the following code is executed?
void main()
{
printf("BCA");
main();
}
Wrong statement
It will keep on printing BCA
It will print BCA once
None of these
What is the result after execution of the following code if a is 10, b is 5, and c is 10?
if ((a > b) && (a <= c))
a = a + 1;
else
c = c+1;
a = 10, c = 10
a = 11, c = 10
a = 10, c = 11
a = 11, c = 11
Which one of the following is a loop construct that will always be executed once?
for
while
switch
do while
Directives are translated by the
Pre-processor
Compiler
Linker
Editor
Which of the following will copy the null-terminated string that is in array src into array dest?
dest = src;
dest == src;
strcpy(dest, src);
strcpy(src, dest);
What will the result of 'num' variable after execution of the following statements?
int num = 58;
num % = 11;
3
5
8
11
What will the result of num1 variable after execution of the following statements?
int j = 1, num1 = 4;
while (++j <= 10)
{
num1++;
}
11
12
13
14
What will be the output of the following code?
#include <stdio.h>
int main()
{
int *ptr, a = 10;
ptr = &a;
*ptr += 1;
printf("%d,%d/n", *ptr, a);
}
10, 10
10, 11
11, 10
11, 11
What will be the output of the following C code?
#include <stdio.h>
void main()
{
int x = 5;
if (x < 1)
printf("hello");
if (x == 5)
printf("hi");
else
printf("no");
}
hi
hello
no
error
The switch statement takes a given integer value then seeks a matching value among a number of _______ statements.
break
case
switch
goto
How many loops are there in C
1
3
2
4
Which of the following is an exit control statement
for
while
do while
continue
The value of i after the execution of the following segment is
i = 2;
for( i=0; i>10; i=i+1);
1
2
0
11
C language developed at _____?
AT & T's Bell Laboratories of USA in 1972
AT & T's Bell Laboratories of USA in 1970
Sun Microsystems in 1973
Cambridge University in 1972
Which of the following is not a correct variable type?
float
real
int
double
int x = 10;
int main()
{
int x = 0;
printf("%d",x);
return 0;
}
10
0
compile error
undefined
To print out 'a' as an integer and 'b' as a floating, 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)
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
1.Relational
2.Arithmetic
3.Logical
4.Assignment
C programs are converted into machine language with the help of
An Editor
A compiler
An operating system
None of these.
int main()
{
int a = 10, b = 25;
a = b++ + a++;
b = ++b + ++a;
printf("%d %d n", a, b);
}
36 64
35 62
36 63
30 28
A name having a few letters, numbers and special character _(underscore) is called
keywords
reserved keywords
tokens
identifiers
Which of the following is not a valid variable name declaration?
int a3;
int 3a;
int _A3;
int a_3
What will be the output of the following C code?
#include <stdio.h>
int main()
{
int a,b,c;
a=5;
b=a++;
c=++a;
printf("%d\n",b);
printf("%d\n", c);
printf("%d\n", a);
}
5 6 7
5 7 7
6 6 7
6 7 7
Identify the output of the program
3, 3, 3
2, 2, 3
4, 2, 3
2, 3, 3
Which of the following is more appropriate for reading in a multi-word string?
scanf()
printf()
puts()
gets()
A single line comment line in a C Language source code can begin with
;
:
//
/*
Collection of Heterogeneous Data is called
Array
Pointer
Structures and Union
Data Type
