Friday, March 19, 2021

C PROGRAMMING QUESTION SET (1 TO 50)


 visit  our website www.itcorner.org.in  for more info about our  Software training Institute

 C  PROGRAMMING  QUESTION  SET


1. Which of the following is not a valid variable name declaration?

a) int __a3;
b) int __3a;
c) int __A3;
d) None of the mentioned

Ans- 1. D

2. All keywords in C are in ____________
a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) None of the mentioned

Ans-2. A

3. Which of the following is not a valid C variable name?
a) int number;
b) float rate;
c) int variable_count;
d) int $main;

Ans-3. D

4. What will be the output of the following C code?

1. #include <stdio.h>

2.     int main()

3.     {

4.         printf("Hello World! %d \n", x);

5.         return 0;

6.     }

a)    Hello World! x;

b)     Hello World! followed by a junk value

c)     Compile time error

d)    d) Hello World!

Ans-4. C

5. The format identifier ‘%i’ is also used for _____ data type.
a) char
b) int
c) float
d) double

Ans-5. B

 

6. What will be the output of the following C code?

1. #include <stdio.h>
2.     int main()
3.     {
4.         int i = 5;
5.         i = i / 3;
6.         printf("%d\n", i);
7.         return 0;
8.     }

a) Implementation defined
b) 1
c) 3
d) Compile time error

Ans-6. B

7.What is the precedence of arithmetic operators (from highest to lowest)?
a) %, *, /, +, –
b) %, +, /, *, –
c) +, -, %, *, /
d) %, +, -, *, /

Ans-7. A

8.Which of the following is not an arithmetic operation?
a) a *= 10;
b) a /= 10;
c) a != 10;
d) a %= 10;

Ans-8. C

9.What will be the output of the following C code?

1.      #include <stdio.h>
2.      void main()
3.      {
4.          int x = 1, y = 0, z = 5;
5.          int a = x && y || z++;
6.          printf("%d", z);
7.      }

 

a) 6
b) 5
c) 0
d) Varies

Ans-9. A

10.What is the result of a logical or relational expression in C?
a) True or False
b) 0 or 1
c) 0 if an expression is false and any positive number if an expression is true
d) None of the mentioned

Ans-10. B

11. Which among the following is NOT a logical or relational operator?
a) !=
b) ==
c) ||
d) =

Ans-11. D

12. What will be the output of the following C code?

1. #include <stdio.h>
2.     int main()
3.     {
4.         int a = 1, b = 1, c;
5.         c = a++ + b;
6.         printf("%d, %d", a, b);
7.     }

a)    a = 1, b = 1
b) a = 2, b = 1
c) a = 1, b = 2
d) a = 2, b = 2

Ans-12. B

13. What will be the output of the following C code?

1. #include <stdio.h>
2.     int main()
3.     {
4.         int a = 10, b = 10;
5.         if (a = 5)
6.         b--;
7.         printf("%d, %d", a, b--);
8.     }

 

a)    a = 10, b = 9

b) a = 10, b = 8
c) a = 5, b = 9
d) a = 5, b = 8

Ans-13. C

14. What will be the output of the following C code?

1. #include <stdio.h>
2.     void main()
3.     {
4.         int x = 4, y, z;
5.         y = --x;
6.         z = x--;
7.         printf("%d%d%d", x,  y, z);
8.     }

a)    3 2 3
b) 2 3 3
c) 3 2 2
d) 2 3 4

Ans-14. B

15. What is the type of the following assignment expression if x is of type float and y is of type int?

 y = x + y;

a)    int
b) float
c) there is no type for an assignment expression
d) double

Ans-15. A

16. Which expression has to be present in the following?

a) exp1
b) exp2
c) exp3
d) All of the mentioned

Ans-16. D

17. Who is called the father of c programming language?

a) Ken Thomson
b) Steve Jobs
c) Bill Gates
d) Denis Ritchie

Ans-17. D

18.Nesting of if-else statement is allowed in c programming?

a) Yes

b) NO

Ans-18. A

19. Can we test range 5 to 7 or 8 to 10 using a switch statement in C Programming ?

switch(choice)
  {
  case 5 :
  case 6 :
  case 7 : 
         printf("Case 5-7");
         break;
  case 8 :
  case 9 :
  case 10: 
         printf("Case 8-10");
         break;
  }

a) Yes

b) No

Ans-19. A

20) How many keywords are available in c language?

a)67

b)36

c)32

d)49

Ans-20. C

21)  What is/are the number of operand/operands needed to unary operator logical not(!)?

a)4

b)3

c)2

d)1

Ans-21 d

22) While assigning a value to a variable, which operators are used to perform artithmetic operations?

a)Logical operator

b)Assignment operator

c)Increment Operator

d)Conditional Operator

Ans-22 b

23)An operator used to check a condition and select a value depending on the value of the condition is called

a)Logical Operator

b)Decrement Operator

c)Conditional or Trnary Operator

d)Bitwise Operator

Ans-23 c

24)The size of a character variable in C is

a)8 Bytes

b)4 Bytes

c)2 Bytes

d)1 Bytes

Ans-24 d

25. Which of the following are themselves a collection of different data types?
a) string
b) structures
c) char
d) all of the mentioned

Ans-25 b

26. Which operator connects the structure name to its member name?
a) –
b) <-
c) .
d) Both <- and .

Ans-26 c

27. Which Header file we can used for in string functions?

a) #include<string.h>
b) #include<strings.h>
c) #include<stringf.h>
d) #include<stringsf.h>

Ans-27 a

28.

Is there any difference between the two statements?
char *ch = "IndiaBIX";
char ch[] = "IndiaBIX";

a)Yes

b)No

Ans-28 a

 

 

 

 


29.Input/output function prototypes and macros are defined in which header file?

a) conio.h

b) stdlib.h

c) stdio.h

d) dos.h

Ans-29 c

 

30)A pointer to a block of memory is effectively same as an array

a)Yes

b)No

 

Ans-30 a

 

31)Using _______ statement is how you test for a specific condition. 

a. Select

b. If

c. Switch

d. For

 

Ans-31 b

 

32)It is possible to pass a structure variable to a function either by value or by address

a)Yes

b)No

 

Ans-32 a

 

33)C programming : If you want to store dissimilar data together, then which type you will use?

a. array

b. structure

c. stack

d. None of the above.

 

Ans-33 b

 

34) Which of the following is a keyword used for a storage class?

a)printf

b)auto

c)switch

d)struct

 

Ans-34 b

 

35) Qhich function is used to read character as you type ?

a)getchar()

b)getch()

c)getche()

d)Both B & C

Ans-35 b

 

36)What the follwing function call mean? Strcpy(s1 , s2 );

a) copies s1 string into s2

b) copies s2 string into s1

c)copies both s1 and s2

d)None of these

Ans-36 a

 

37 )Which is valid string function ?

a) strpbrk

b) strlen

c) strxfrm

d) strcut

 

Ans-37 b

 

38) int **x;

a) x is a pointer to pointer

b) x is not pointer

c) x is long

d) None of these

Ans-38 a

 

39)A declaration float a,b; accupies ______of memory ?

a) 1 bytes

b) 4bytes

c) 8byte

d) 16 bytes

Ans-39 c

 

40)C was developed in the year ___

a)1970

b)1972

c)1976

d)1980

 

Ans-40 b

 

41)C is a ___ language

a) High Level

b) Low Level

c) Middle Level

d) Machine Level

Ans-41 c

 

42)Which of the following are tokens in C?

a) Keywords

b) Variables

c) Constants

d) All of the above

 

Ans-42 d

 

 43)How many times i value is checked in the following C code?

 

1. #include <stdio.h>
2.     int main()
3.     {
4.         int i = 0;
5.         do {
6.             i++;
7.             printf("in while loop\n");
8.         } while (i < 3);
9.     }

a) 2
b) 3
c) 4
d) 1

Ans-43 b

 

44) How many times i value is checked in the following C code?

 

1. #include <stdio.h>
2.     int main()
3.     {
4.         int i = 0;
5.         while (i < 3)
6.             i++;
7.         printf("In while loop\n");
8.     }

 

a) 2
b) 3
c) 4
d) 1

Ans-44 c

 

45)Which operator in C is called a ternary operator

a) if..then

b)++

c)()

d)?

 

Ans-45 d

 

46)Which of the following header file is required for strcpy() function?

a) string.h

b) strings.h

c) files.h

z) strcpy()

 

Ans-46 a

 

47). What will be the output of the following C code?

 

1. #include <stdio.h>
2.     void main()
3.     {
4.         double k = 0;
5.         for (k = 0.0; k < 3.0; k++)
6.             printf("Hello");
7.     }

a) Run time error
b) Hello is printed thrice
c) Hello is printed twice
d) Hello is printed infinitely

 

Ans-47 b

 

 

 

48). What will be the output of the following C code?

1. #include <stdio.h>
2.     struct student
3.     {
4.         int no;
5.         char name[20];
6.     }
7.     void main()
8.     {
9.         struct student s;
10.         s.no = 8;
11.         printf("hello");
12.     }

a) Compile time error
b) Nothing
c) hello
d) Varies

Ans-48 a

 

49)Maximum number of elements in the array declaration int a[5][8] is

a)28

b)32

c)35

d)40

 

Ans-49) d

 

50) What will be the output of the following program ?

void main ( )

{

int x=10,y=20; printf (“\n %d”,x,y);

}

a)10

b)20

c)10 20

d)None of these

 

Ans-50) c

 

 

 

 

 

 

 

 

 

 

 

 

 

 

No comments:

Post a Comment

cprogramminginmarathi

C Programmin Marathi Notes Chapter 1. Introduction C History Of C :       १९९६ च्या दशकाच्या उत्तराध्रारात operating system आणि hardware याव...