Tuesday, March 23, 2021

C PROGRAMMING QUESTION SET (51 TO 100)

 

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7770245024450461"

     crossorigin="anonymous"></script>

C PROGRAMMING QUESTION SET (51 TO 100) Visit Our website www.itcorner.org.in for more info

51.What is the 16-bit compiler allowable range for integer constants?

a.                 -3.4e38 to 3.4e38

b.     -32767 to 32768

c.      -32668 to 32667

d.     -32768 to 32767

ANS 51: D

52.What is required in each C program?

a.                 The program must have at least one function.

b.     The program does not require any function.

c.      Input data

d.     Output data

ANS 52: A

53.Study the following program:

1.     main()  

2.     {printf("ITCORNER");  

3.     main();}  

 

What will be the output of this program?

a.                 Wrong statement

b.     It will keep on printing ITCORNER

c.      It will Print javatpoint once

d.     None of the these

 

ANS 53 : b

 

 

 

54.What will this program print?

1.     main()  

2.     {  

3.       int i = 2;  

4.       {  

5.         int i = 4, j = 5;  

6.          printf("%d %d", i, j);  

7.       }    

8.       printf("%d %d", i, j);  

9.     }  

a.     4525

b.     2525

c.      4545

d.     None of the these

ANS 54 : a

55.Which of the following comment is correct when a macro definition includes arguments?

a.                 The opening parenthesis should immediately follow the macro name.

b.     There should be at least one blank between the macro name and the opening parenthesis.

c.      There should be only one blank between the macro name and the opening parenthesis.

d.     All the above comments are correct.

 

ANS 55 : A

 

56.What is a lint?

a.                 C compiler

b.     Interactive debugger

c.      Analyzing tool

d.     C interpreter

ANS 56 : c

57.What is the output of this statement "printf("%d", (a++))"?

a.                 The value of (a + 1)

b.     The current value of a

c.      Error message

d.     Garbage

 

ANS 57 : b

58.Study the following program:

1.     main()  

2.     {  

3.        char x [10], *ptr = x;  

4.       scanf ("%s", x);  

5.       change(&x[4]);  

6.     }  

7.      change(char a[])  

8.      {  

9.        puts(a);  

10.                         }  

If abcdefg is the input, the output will be

a.                 abcd

b.     abc

c.      efg

d.     Garbage

 

ANS 58 : c

59.Study the following program:

1.     main()  

2.     {  

3.       int a = 1, b = 2, c = 3:  

4.       printf("%d", a + = (a + = 3, 5, a))  

5.     }  

What will be the output of this program?

a.                 6

b.     9

c.      12

d.     8

ANS 59 : d

60.What does this declaration mean?

1.     int x : 4;  

a.     X is a four-digit integer.

b.     X cannot be greater than a four-digit integer.

c.      X is a four-bit integer.

d.     None of the these.

ANS 60 : c

61.Why is a macro used in place of a function?

a.                 It reduces execution time.

b.     It reduces code size.

c.      It increases execution time.

d.     It increases code size.

ANS 61 : d

62.In the C language, the constant is defined _______.

a.                 Before main

b.     After main

c.      Anywhere, but starting on a new line.

d.     None of the these.

 

ANS 62 : C

 

 

63.How many times will the following loop execute?

1.     for(j = 1; j <= 10; j = j-1)  

a.     Forever

b.     Never

c.      0

d.     1

ANS 63  : a

64. A pointer is a memory address. Suppose the pointer variable has p address 1000, and that p is declared to have type int*, and an int is 4 bytes long. What address is represented by expression p + 2?

a.                 1002

b.     1004

c.      1006

d.     1008

ANS 64 : d  

65.What is the result after execution of the following code if a is 10, b is 5, and c is 10?

1.     If ((a > b) && (a <= c))  

2.             a = a + 1;  

3.     else  

4.             c = c+1;  

a.     a = 10, c = 10

b.     a = 11, c = 10

c.      a = 10, c = 11

d.     a = 11, c = 11

 

ANS 65  : b

 

 

66.Which one of the following is a loop construct that will always be executed once?

a.                 for

b.     while

c.      switch

d.     do while

ANS 66  : d

67.Which of the following best describes the ordering of destructor calls for stack-resident objects in a routine?

a.                 The first object created is the first object destroyed; last created is last destroyed.

b.     The first object destroyed is the last object destroyed; last created is first destroyed.

c.      Objects are destroyed in the order they appear in memory, the object with the lowest memory address is destroyed first.

d.     The order is undefined and may vary from compiler to compiler.

 

ANS 67 : b

68.How many characters can a string hold when declared as follows?

1.     char name[20]:  

a.     18

b.     19

c.      20

d.     None of the these

ANS 68 : c

69.Directives are translated by the

a.                 Pre-processor

b.     Compiler

c.      Linker

d.     Editor

ANS 69 : a

70.How many bytes does "int = D" use?

a.                 0

b.     1

c.      2 or 4

d.     10

ANS 70 : c

71.What feature makes C++ so powerful?

a.                 Easy implementation

b.     Reusing the old code

c.      Easy memory management

d.     All of the above

ANS 71 : d

72.Which of the following will copy the null-terminated string that is in array src into array dest?

a.                 dest = src;

b.     dest == src;

c.      strcpy(dest, src);

 

d.     strcpy(src, dest);

ANS 72 : C

 

73.In the statement "COUT << "javatpoint" << end1;", end1 is a ___.

a.                 Extractor

b.     Inserter

c.      Manipulator

d.     Terminator

 

ANS 73 : c

 

74.Each instance of a class has a different set of

a.                 Class interfaces

b.     Methods

c.      Return types

d.     Attribute values

ANS 74 : d

75.How many instances of a class can be declared?

a.                 1

b.     10

c.      As per required

d.     None of the these

ANS 75 : C

76.What will the result of num variable after execution of the following statements?

1.     int num = 58;  

2.     num % = 11;  

a.     3

b.     5

c.      8

d.     11

ANS 76 : a

77.What is the maximum number of characters that can be held in the string variable char address line [40]?

a.                 38

b.     39

c.      40

d.     41

 

ANS 77 : b

78. What will the result of num1 variable after execution of the following statements?

1.     int j = 1, num1 = 4;  

2.     while (++j <= 10)  

3.     {  

4.       num1++;  

5.     }  

a.     11

b.     12

c.      13

d.     14

ANS 78 : C

79. What will the result of len variable after execution of the following statements?

1.     int len;  

2.     char str1[] = {"39 march road"};  

3.     len = strlen(str1);  

a.     11

b.     12

c.      13

d.     14

ANS 79 : C

80. Study the following statement

1.     #include <stdio.h>  

2.         int main()  

3.         {  

4.             int *ptr, a = 10;  

5.             ptr = &a;  

6.             *ptr += 1;  

7.             printf("%d,%d/n", *ptr, a);  

8.         }  

What will be the output?

a.                 10, 10

b.     10, 11

c.      11, 10

d.     11, 11

ANS 80: d

81.Given the following statement, what will be displayed on the screen?

1.     int * aPtr;  

2.     *aPtr = 100;  

3.     cout << *aPtr + 2;  

a.     100

b.     102

c.      104

d.     108

ANS 81 : b

82.Give the following declarations and an assignment statement. Which one is equivalent to the expression str [4]?

1.     char str[80];  

2.     char * p;  

3.     p = str;  

a.     p + 4

b.     *p + 4

c.      *(p + 4)

d.     p [3]

ANS 82 : c

83.Which one is the correct description for the variable balance declared below?

1.     int ** balance;  

a.     Balance is a point to an integer

b.     Balance is a pointer to a pointer to an integer

c.      Balance is a pointer to a pointer to a pointer to an integer

d.     Balance is an array of integer

ANS 83: b

84.A class D is derived from a class B, b is an object of class B, d is an object of class D, and pb is a pointer to class B object. Which of the following assignment statement is not valid?

a.                 d = d;

b.     b = d;

c.      d = b;

d.     *pb = d:

ANS 84 : c

85.Which of the following statement is not true?

a.                 A pointer to an int and a pointer to a double are of the same size.

b.     A pointer must point to a data item on the heap (free store).

c.      A pointer can be reassigned to point to another data item.

d.     A pointer can point to an array.

ANS 85 : b

 

86.Which of the following SLT template class is a container adaptor class?

a.                 Stack

b.     List

c.      Deque

d.     Vector

ANS 86 : a

87.What kinds of iterators can be used with vectors?

a.                 Forward iterator

b.     Bi-directional iterator

c.      Random access iterator

d.     All of the above

ANS 87 : d

88.Let p1 be an integer pointer with a current value of 2000. What is the content of p1 after the expression p1++ has been evaluated?

a.                 2001

b.     2002

c.      2004

d.     2008

ANS 88 : c

89.Let p1 and p2 be integer pointers. Which one is a syntactically wrong statement?

a.                 p1 = p1 + p2;

b.     p1 = p1 - 9;

c.      p2 = p2 + 9;

d.     cout << p1 - p2;

ANS 89 : a

 

90.Suppose that cPtr is a character pointer, and its current content is 300. What will be the new value in cPtr after the following assignment?

1.     cPtr = cPtr + 5;  

a.     305

b.     310

c.      320

d.     340

ANS 90 :a

91.Which is valid expression in c language?

a.                 int my_num = 100,000;

b.     int my_num = 100000;

c.      int my num = 1000;

d.     int my num == 10000;

ANS 91: b

92.If addition had higher precedence than multiplication, then the value of the expression (1 + 2 * 3 + 4 * 5) would be which of the following?

a.                 27

b.     47

c.      69

d.     105

ANS 92 : d

93.What will be the output of this program?

1.     int main()      

2.     {      

3.     int a=10, b=20;        

4.     printf("a=%d b=%d",a,b);        

5.     a=a+b;      

6.     b=a-b;      

7.     a=a-b;      

8.     printf("a=%d b=%d",a,b);      

9.     return 0;    

10.                        }     

a.     a = 20, b = 20

b.     a = 10, b = 20

c.      a = 20, b = 10

d.     a = 10, b = 10

ANS 93 : C

94.The following statements are about EOF. Which of them is true?

a.                 Its value is defined within stdio.h

b.     Its value is implementation dependent

c.      Its value can be negative

d.     Its value should not equal the integer equivalent of any character

e.     All of the these

ANS  94 : b

95.What does this statement mean?

1.     x - = y + 1;  

a.     x = x - y + 1

b.     x = -x - y - 1

c.      x = x + y - 1

d.     x = x - y - 1

ANS 95 : d

96.Study the following statement

1.     for (i = 3; i < 15; i + = 3)  

2.     {printf ("%d", i);  

3.      ++i;  

4.     }  

What will be the output?

a.                 3 6 9 12

b.     3 6 9 12 15

c.      3 7 15

d.     3 7 11 15

ANS :96  c

97.Study the following statement

1.     main()  

2.     {     

3.        char *s = "Hello,"  

4.        "World!";  

5.        printf("%s", s);  

6.     }  

 

 

 

 

What will be the output?

a.                 Hello, World!

b.     Hello,World!

c.      Hello

d.     Compile error

ANS 97 : b

98.Study the following array definition

1.     int num[10] = {3, 3, 3};  

Which of the following statement is correct?

a.                 num[9] is the last element of the array num

b.     The value of num[8] is 3

c.      The value of num[3] is 3

d.     None of the above

ANS 98 : a

99.What will the output after execution of the following statements?

1.     main()  

2.     {  

3.       printf ("\\n ab");  

4.       printf ("\\b si");  

5.       printf ("\\r ha");  

6.     }  

a.     absiha

b.     asiha

c.      haasi

d.     hai

 

ANS 99 : d

 

 

100.      What will the output after execution of the following statements?

1.     void main()  

2.     {  

3.       int i = 065, j = 65;  

4.       printf ("%d %d", i, j);  

5.     }  

a.     065 65

b.     53 65

c.      65 65

d.     Syntax error

ANS 100 : b


No comments:

Post a Comment

cprogramminginmarathi

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