C Objective Questions And Answers - 192

Page 1 (1- 50)

Question: 1

Can we declare function inside structure of C Programming?

(A) Yes
(B) No
(C) Depends on Compiler
(D) Yes but run time error

Compiler  Forum
[ Expert : structure ] [ Posted by - Admin : Chicago, USA ]


Question: 2

What is storage class for variable A in below code?

int main()
{
int A;
A = 10;
printf("%d", A);
return 0;
}

(A) extern
(B) auto
(C) register
(D) static

Compiler  Forum
[ Expert : storgeclass ] [ Posted by - Admin : Chicago, USA ]


Question: 3

What is output of below program?
int main()
{
const int a = 10;
printf("%d",++a);
return 0;
}

(A) 11
(B) 10
(C) Compilation Error
(D) 0

Compiler  Forum
[ Beginner : operators ] [ Posted by - Admin : Chicago, USA ]


Question: 4

Library function pow() belongs to which header file?

(A) mathio.h
(B) math.h
(C) square.h
(D) stdio.h

Compiler  Forum
[ Practitioner : function ] [ Posted by - Admin : Chicago, USA ]


Question: 5

Libray function getch() belongs to which header file?

(A) stdio.h
(B) conio.h
(C) stdlib.h
(D) stdlibio.h

Compiler  Forum
[ Beginner : function ] [ Posted by - Admin : Chicago, USA ]


Question: 6

What is the following is invalid header file in C?

(A) math.h
(B) mathio.h
(C) string.h
(D) ctype.h

Compiler  Forum
[ Practitioner : function ] [ Posted by - Admin : Chicago, USA ]


Question: 7

What is output of below code?

int main()
{
char name[]="Cppbuz";
int len;
int size;
len = strlen(name);
size = size_of(name);
printf("%d,%d",len,size);
return 0;
}

(A) 6,6
(B) 6,7
(C) 7,7
(D) 0,0

Compiler  Forum
[ Practitioner : function ] [ Posted by - Admin : Chicago, USA ]


Question: 8

The concept of two functions with same name is know as?

(A) Operator Overloading
(B) Function Overloading
(C) Function Overriding
(D) Function renaming

Compiler  Forum
[ Practitioner : function ] [ Posted by - Admin : Chicago, USA ]


Question: 9

What is the meaning of below lines?
void sum (int, int);

(A) sum is function which takes int arguments
(B) sum is a function which takes two int arguments and returns void
(C) it will produce compilation error
(D) Can't comment

Compiler  Forum
[ Practitioner : function ] [ Posted by - Admin : Chicago, USA ]


Question: 10

When C Language was invented?

(A) 1970
(B) 1972
(C) 1978
(D) 1979

Compiler  Forum
[ Beginner : other ] [ Posted by - Admin : Chicago, USA ]


Question: 11

How many loops are there in C

(A) 2
(B) 3
(C) 4
(D) 1

Compiler  Forum
[ Beginner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 12

What is the output of below program?

int main()
{
for(; ;)
for(; ;)
    printf("Hello..");

return 0;
}

(A) Compilation Error
(B) Runtime Error
(C) Hello is printed one time
(D) Hello is printed infinite times

Compiler  Forum
[ Expert : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 13

What is output of below program?

int main()
{
 for(; ;);
 for(; ;);
    printf("Hello");
return 0;
}

(A) Compilation Error
(B) Runtime Error
(C) Nothing is printed
(D) Hello is printed infinite times

Compiler  Forum
[ Expert : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 14

What is the output of below program?
int main()
{
 int i;

 for(i = 0,i<5,i++)
 {
   printf("Hello");
 }

 return 0;
}

(A) Hello is printed 5 times
(B) Compilation Error
(C) Runtime Error
(D) Hello is printed 4 times

Compiler  Forum
[ Expert : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 15

What is output of below program?

int main()
{
 int i;
 for(i=0; i<5; ++i++)
 {
   printf("Hello");
 }
 return 0;
}

(A) Hello is printed 5 times
(B) Compilation Error
(C) Hello is printed 2 times
(D) Hello is printed 3 times

Compiler  Forum
[ Expert : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 16

What is output of below program?
int main()
{
 int i,j;
 for(i = 0,j=0;i<5;i++)
 {
   printf("%d%d--",i,j);
 }
 return 0;
}

(A) 0--01--12--23--34--
(B) 00--10--20--30--40--
(C) Compilation Error
(D) 00--01--02--03--04--

Compiler  Forum
[ Expert : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 17

What is output of below program?

int main()
{
int i,j,k,count;
count=0;
for(i=0;i<5;i++)
{
   for(j=0;j<5;j++)
   {
      count++;
   }
}
printf("%d",count);
return 0;
}

(A) 5
(B) 10
(C) 25
(D) 50

Compiler  Forum
[ Practitioner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 18

What is output of below program?

int main()
{
  int i;
  for(i=0; i<5; i++);
  {
    printf("cppbuzz");
  }

  return 0;
}

(A) cppbuzz is printed 5 times
(B) Compilation Error
(C) cppbuzz is printed 1 times
(D) Nothing is printed

Compiler  Forum
[ Practitioner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 19

What is output of below program?

int main()
{
int i,j,count;
count=0;
for(i=0; i<5; i++);
{ 
	for(j=0;j<5;j++);
	{
	    count++;
	}
}
printf("%d",count);
return 0;
}

(A) 55
(B) 54
(C) 1
(D) 0

Compiler  Forum
[ Practitioner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 20

How many times CppBuzz.com is printed?

int main()
{
while(1)
{
    printf("CppBuzz.com");
}

return 0;
}

(A) 1 time
(B) Compilation Error
(C) Infinite times
(D) Runtime Error

Compiler  Forum
[ Practitioner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 21

How many times CppBuzz.com is printed?
int main()
{
while(1);
{
    printf("CppBuzz.com");
}

return 0;
}

(A) 1 time
(B) 0 time
(C) Compilation/Runtime Error
(D) Blank Screen in Infinite Loop

Compiler  Forum
[ Practitioner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 22

What is printed on console?
int main()
{
int a = 0;
while(a)
{
    printf("CppBuzz.com");
}

return 0;
}

(A) CppBuzz.com is printed Infinite times
(B) CppBuzz.com is printed 1 time only
(C) Nothing is printed
(D) Program gives error

Compiler  Forum
[ Practitioner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 23

How many times CppBuzz.com is printed on console?
int main()
{
int a = 0;
while(a==0)
{
    printf("CppBuzz.com");
}

return 0;
}

(A) 0 times
(B) Infinite times (Untill Stack is overflow)
(C) 1 time
(D) Nothing is printed

Compiler  Forum
[ Expert : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 24

How many times CppBuzz.com is printed on console?
int main()
{
int a = 0;
while(a++)
{
    printf("CppBuzz.com");
}

return 0;
}

(A) Nothing is printed on screen
(B) 0 time
(C) 1 time
(D) Infinite times (Untill Stack overflow)

Compiler  Forum
[ Practitioner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 25

How many times CppBuzz.com is printed?
int main()
{
int a = 0;
while(a++);
{
    printf("CppBuzz.com");
}

return 0;
}

(A) 0 time
(B) 1 time
(C) Compilation Error
(D) Infinite times

Compiler  Forum
[ Practitioner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 26

How may times CppBuzz.com is printed?
int main()
{
int a = 0;
while(++a++);
{
    printf("CppBuzz.com");
}

return 0;
}

(A) 1 time
(B) 0 time
(C) Infinite times
(D) Error: Lvalue Required

Compiler  Forum
[ Beginner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 27

How many times CppBuzz.com is printed?
int main()
{
int a = 0;
while(++a)
{
    printf("CppBuzz.com");
}

return 0;
}

(A) 1 time
(B) Infinite Times(Untill Stack is overflow)
(C) 2 times
(D) Error

Compiler  Forum
[ Beginner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 28

How many times CppBuzz.com is printed?
int main()
{
int a = 0;
while(a)
printf("CppBuzz.com");

return 0;
}

(A) 1 time
(B) Compilation Error
(C) 0 time
(D) Infinite Times(Untill Stack is Overflow)

Compiler  Forum
[ Beginner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 29

How many times CppBuzz.com is printed?
int main()
{
int a = 0;
while(a++)
printf("CppBuzz.com");

return 0;
}

(A) 1 time
(B) 0 time
(C) Infinite times(Untill Stack is overflow)
(D) 2 times

Compiler  Forum
[ Beginner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 30

How many times CppBuzz.com is printed?

int main()
{
int a = 0;
while(a++ < 5)
printf("CppBuzz.com");
return 0;
}

(A) 4 times
(B) 5 times
(C) 0 time
(D) Infinite times

Compiler  Forum
[ Practitioner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 31

How many times CppBuzz.com is printed?
int main()
{
int a = 0;
while(a++ < 5-++a)
printf("CppBuzz.com");
return 0;
}

(A) 5 times
(B) 4 times
(C) 2 times
(D) 1 time

Compiler  Forum
[ Expert : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 32

int main()
{
    int x;
    x=10,20,30;
    printf("%d",x);
    return 0;
}

(A) 10
(B) 20
(C) 30
(D) Compilation Error

Compiler  Forum
[ Expert : operators ] [ Posted by - Admin : Chicago, USA ]


Question: 33

int main()
{
    int a = 320;
    char *ptr;
    ptr =( char *)&a;
    printf("%d",*ptr);
    return 0;
}

(A) 320
(B) 60
(C) 160
(D) 64

Compiler  Forum
[ Practitioner : pointers ] [ Posted by - Admin : Chicago, USA ]


Question: 34

int main()
{
    char arr[5]="The CppBuzz.com";
    printf("%s",arr);
    return 0;
}

(A) The CppBuzz.com
(B) The C
(C) The CppBuzz
(D) Compilation Error

Compiler  Forum
[ Practitioner : datatype ] [ Posted by - Admin : Chicago, USA ]


Question: 35

int main()
{
    int a = 5;
    int b = 10;
    int c = a+b;
    printf("%i",c);
}

(A) 0
(B) 15
(C) Undefined i
(D) Any other Compiler Error

Compiler  Forum
[ EXpert : datatype ] [ Posted by - Admin : Chicago, USA ]


Question: 36

int main()
{
	int _ = 10;
	int __ = 20;
	int ___ = _ + __;
	printf("__%d",___);
	return 0;
}

(A) Compilation Error
(B) Runtime Error
(C) __0
(D) __30

Compiler  Forum
[ Expert : datatype ] [ Posted by - Admin : Chicago, USA ]


Question: 37

int main()
{
    int a = 10.5;
    printf("%d",a);
    return 0;
}

(A) 10.5
(B) 10
(C) 0
(D) Compilation Error

Compiler  Forum
[ Beginner : datatype ] [ Posted by - Admin : Chicago, USA ]


Question: 38

Which of the following is executed by Preprocess?

(A) #include<stdio.h>
(B) return 0
(C) void main(int argc , char ** argv)
(D) None of above

Compiler  Forum
[ Beginner : datatype ] [ Posted by - Admin : Chicago, USA ]


Question: 39

What should be the output:
int main()
{ 
    int a = 10/3;
    printf("%d",a); 
    
    return 0;
}

(A) 3.33
(B) 3.0
(C) 3
(D) 0

Compiler  Forum
[ Beginner : datatype ] [ Posted by - Admin : Chicago, USA ]


Question: 40

int main()
{ 
    int a = printf ("CppBuzz.com");
    printf("%d", a);
    return 0;
}

(A) Compilation Error
(B) 0
(C) CppBuzz.com
(D) CppBuzz.com11

Compiler  Forum
[ Beginner : function ] [ Posted by - Admin : Chicago, USA ]


Question: 41

Which programming language is more faster among these?

(A) Java
(B) PHP
(C) C
(D) Visual Basic

Compiler  Forum
[ Beginner : other ] [ Posted by - Admin : Chicago, USA ]


Question: 42

//This program is compiled on 32 bit DEV-C++ 
int main()
{

char *ptr1, *ptr2;
printf("%d %d", sizeof(ptr1), sizeof(ptr2));

return 0;
} 

(A) 1 1
(B) 2 2
(C) 4 4
(D) Undefined

Compiler  Forum
[ Beginner : pointers ] [ Posted by - Admin : Chicago, USA ]


Question: 43

int x = 10;

int main()
{
    int x = 0;
    printf("%d",x);
    return 0;
}

(A) 10
(B) 0
(C) Compilation Error
(D) Undefined

Compiler  Forum
[ Expert : datatype ] [ Posted by - Admin : Chicago, USA ]


Question: 44

int main()
{
     int x = 10;
	{
	    int x = 0;
	    printf("%d",x);
	}
    return 0;
}

(A) 10
(B) Compilation Error
(C) 0
(D) Undefined

Compiler  Forum
[ Beginner : loops ] [ Posted by - Admin : Chicago, USA ]


Question: 45

Is the following statement a declaration or definition
extern int i;

(A) Declaration
(B) Definition

Compiler  Forum
[ Beginner : storgeclass ] [ Posted by - Admin : Chicago, USA ]


Question: 46

int main()
{
extern int i;
i = 20;
printf("%d", sizeof(i));
return 0;
}

(A) 20
(B) 0
(C) Undefined reference to i
(D) Linking Error

Compiler  Forum
[ Beginner : storgeclass ] [ Posted by - Admin : Chicago, USA ]


Question: 47

Is it true that a function may have several declaration, but only one definition.

(A) True
(B) False

Compiler  Forum
[ Practitioner : function ] [ Posted by - Admin : Chicago, USA ]


Question: 48

What is sizeof() in C?

(A) Operator
(B) Function
(C) Macro
(D) None of these

Compiler  Forum
[ Expert : operators ] [ Posted by - Admin : Chicago, USA ]


Question: 49

How many main() function we can have in our project?

(A) 1
(B) 2
(C) No Limit
(D) Depends on Compiler

Compiler  Forum
[ Beginner : function ] [ Posted by - Admin : Chicago, USA ]


Question: 50

Is it possible to run program without main() function?

(A) Yes
(B) No

Compiler  Forum
[ Beginner : function ] [ Posted by - Admin : Chicago, USA ]