C Objective Questions

No commas or blanks are allowed within an integer or a real constant. True False A
'void' is a datatype. True False A
'emp name' is a valid variable name. True False B
'unsigned' is a valid variable name. True False B
Operation between an integer and float always yields a float result. True False A
/* The C language.
/* is a procedural language .*/*/
The above statement is valid.
True False B
The default initial value of automatic storage class is 0. True False B
= and = = have the same operation. True False B
Character data types cannot be declared as unsigned. True False B
&& and & operators have the same meaning. True False B
Right shifting an operand 1bit is equivalent to multiplying it by 2.
True False B
The same variable names of automatic type can be used in different functions without any conflict. True False A
printf("%d", sizeof('2')); will print 2. True False B
The expression "b = 3 ^ 2;" will evaluate b = 9. True False B
The expression "int i = j = k = 0;" is invalid. True False A
printf() is not a library function. True False B
The expression (i + j)++ is illegal. True False A
The expression 'int j = 6 + 3 % -9;' evaluates to -1. True False B
p++ executes faster than p + 1. True False A
static variable will not always have assigned value. True False A
Variables declared as register storage type gets stored in CPU registers. True False A
Single operations involving entire arrays are permitted in C. True False A
The main() function can be called from any other function. True False A
The main() function can call itself recursively. True False A
The statement "for (i = 0, j = 2; j <= 10; j++)" is a valid statement in 'C'. True False A
When a user defined function is defined in program, then it has to be called at least once from the main(). True False B
Left shift operator rotates the bits on the left and places them to the right. True False B
A recursive function calls itself again and again. True False A
Only one break can be used in one loop. True False B
Every if statement can be converted into an equivalent switch statement. True False B
Nested macros are allowed. True False B
Expression 4**3 evaluates to 64. True False B
All macro substitutions in a program are done before compilation of the program. True False A
'# define PI = 8;' is the correct declaration of macros. True False B
An array declared as A[100][100] can hold a maximum of 100 elements. True False B
The array 'char name[10] can consist of a maximum of 9 characters. True False A
It is necessary to initialize the array at the time of declaration. True False B
the value *(&i) is same as printing the value of address of i. True False B
A pointer is an indication of the variable to be accessed next. True False B
The contents of a file opened in 'r+' mode cannot be changed. True False B
Union is used to hold different data at different time. True False A
All elements of a structure are allocated contiguous memory locations. True False A
enum helps to create user defined datatype. True False A
The value of an enumerated datatype can be read using scanf() function. True False B
Structures within structures cannot be created. True False B
gets() and puts() are unformatted I/O functions. True False A
The identifier argv[] is a pointer to an array of strings. True False B
fprintf()function can be used to write into console. True False B
fopen() function returns a pointer to the open file. True False A
Which of the following language is predecessor to C Programming Language?



A B BCPL
C++
B
C programming language was developed by



Dennis Ritchie Ken Thompson Bill Gates Peter Norton
A
C is a ___ language




High Level and Procedural Low Level and OOPS Middle Level and Procedural Machine Level and OOPS A
Which escape character can be used to beep from speaker in C?



\a \b \m \n A
Which of the following is invalid?


'' " " 'a' 'abc'
D
A declaration float a, b; occupies ___ of memory




1 byte 4 bytes 8 bytes 16 bytes C
The printf() function retunes which value when an error occurs?



Positive value Zero Negative value None of these C
Identify the wrong statement




putchar(65) putchar('x') putchar("x") putchar('\n') C
Which header file is essential for using strcmp() function?




string.h strings.h text.h strcmp.h A
Which among the following is a unconditional control structure


do-while if-else goto for
C
continue statement is used




to go to the next iteration in a loop come out of a loop exit and return to the main function restarts iterations from beginning of loop D
Which of the following is an example of compounded assignment statement?




a = 5 a += 5 a = b = c a = b C
In the expression - 'x + y + 3z =20'




'x + y' is a keyword 3 and 20 are constants 3z is a constant y is a variable and z is a constant B
The output of the following code is:
void main()
{
int z, a = 5, b = 3;
z = a * 2 + 26 % 3;
printf("%d", z);
}




10 0 12 None of the above C
Which options shows the correct hierarchy of arithmetic operators




**, * or /, + or - **, *, /, +, -
**, /, *, +,-
/ or *, - or + D
The output of the following code is:
void main()
{
float a;
int x = 10, y = 3;
a = x / y;
printf("%f", a);
}




3.999999 Error 3 3.000000 D
The output of the following code is:
void main()
{
char a = 'B';
switch (a)
{
case 'A' : printf("a");
case 'B' : printf("b");
default : printf("c");
}




B b bca bc D
The output of the following code is:
void main()
{
int a = 20;
printf("%d\t%d\n", ++a, a);
}





21 21 20 21 21 20 20 20 C
How many times the following loop will execute?
for (a = 0; a < 4; a++)
printf("hello\n");



3 4 5 infinite B
The output of the following code is:
void main()
{
int a;
int &b = a;
a=100;

printf("b=%d\ta=%d\n", b,a);
}




b=100 a=100 b=100 a=0 b=0 a=100 Error D

The output of the following code is:
void main()
{
int a = 0;
while (a<=50)
for(;;)
if(++a % 50==0)
break;
printf("a = %d", a);
}


a = 100 a = 50 compilation error

runtime error A
The output of the following code is:
int f(int a, int b);
void main()
{
int a = 12, b=154;
printf("%d", f(a, b));
}

int f(int a, int b)
{
if (a if(b==0) return(a);
return (f(b, a % b));
}




2 1 Compilation error Runtime error A
The output of the following code is:
void main()
{
int a = 1, b=2;
int *ip;
ip=&a;
b=*ip;
printf("%d", b);
}





2 1 100 0 B
The output of the following code is:
void main()
{
static int a = 1, b, c;
if (a>=2)
b=2;
c=3;
printf("%d\t%d", b,c);
}




2 3 0 3 0 0 2 0 B
The output of the following code is:
#define sqr(x= x*x)
main()
{
int a = 10, b = 5;
printf("%d, %d", sqr(a+b),sqr(++a));
}




77, 121 225, 121 77, 144 Compilation error D
struct stud
{
int roll;
char name[20];
float marks;
} *p;

What will be the byte size of p?



24 2 26
None B
The output of the following code is:
main()
{
unsigned int a = 10;
while (a>=10)
{
int a;
a-- ;
}
printf("%i", a);
}




Infinite loop 9 0 None A
The output of the following code is:
main()
{
xyz:
goto abc;
printf("Hello");
abc:
printf("World");
goto xyz;
}





Infinite loop Hello World World Hello Compilation error A
The output of the following code is:
main()
{
int a = 0;
for (; i = 0; i++)
printf("%d", a);
}





0 Nothing will be displayed Infinite loop None of the above D
The output of the following code is:
void change (char *k)
{
k="Hello";
return;
}
main()
{
char *ch = "World";;
change(ch);
printf("%s", ch);
}




Hello World Compilation error Hello World B
Which of the following is not an infinite loop




int i =1;
while (1)
{i++;}
for( ; ; ); int true=0, false;
while (true)
{false = 1;}
int y, x = 0;
do
{y = x;}
while (x==0);
C
do-while loop is useful when we want the statements within the loop must be executed


Only once At least once More than Once Any one of the above B
Which of the following is not a preprocessor directive




#if #elseif #undef #pragma B
The output of the following code is:
main()
{
int a = 5, b = 6;
(a == b? printf("%d", a));
}



0 5 Error None of the above C
The output of the following code is:
main()
{
int k, num = 30;
k = (num > 5 ? (num <= 10 ? 100 : 200) : 500);
printf("\n%d", num);
}



200 500
30 Unpredictable C
The output of the following code is:
main()
{
void msg()
{
printf("HELLO WORLD");
}
}


HELLO WORLD Error
None of the above B
The output of the following code is:
main()
{
int sub[50];
for(i=0; i<=48;i++)
{
sub[i]=i;
printf("\n%d", sub[i]);
}
}




0 to 48 will be displayed 48 49 Compilation Error D
The output of the following code is:
main()
{
int a[10], i;
for (i = 1; I <= 0; i++)
{
scanf("%d", a[i]);
printf("%d", a[i]);
}
}



10
Logical error Runtime error 1 to 10 will be displayed B
Which of the following expressions is wrong




float a =123.56; char ch ='T' * 'A'; char ch ='T' *20; 3 +a = b; D
strcat() function ----------------------- two strings. delete concatenate compare none of the above B
A function to be called must be ended with a----------------
. ? ; none of the above C
The function fopen() on failure returns---------------------. 0 NULL 1 none of the above B
The-------------------- statement helps immediate exit from any part of the loop break continue exit All of the above A
The -------------------------- loop executes at least once. for while do-while while & do-while C
char *s[10] defines an array of ------------------------ pointers to strings string to pointer both A
A multidimensional array A[10][9] can store-------- number of elements 91 88 90 89 C
The size of signed integer is ------ bytes. 4 2 8 10 B
There are total ------ numbers of operators in 'C'. 35 45 55 40 B
------ is the ternary operator ?,- ?,: ++,-- none of the above B
unsigned char has a range from 0 to ------------ 253 254 255 256 C
If 'str' is a string of 7 characters, the statement printf("%4s", str); will display ------characters.
4 7 6 0 A

0 comments: