C Programing
1. A block comments begins and ends with?
A. Start with / and end with //
B. Start with /* and end with */
C. Start with // and end with //
D. Start with < and end with >
2. A character variable can store how many characters at a time?
A. 1 character
B. 8 character
C. 255 character
D. None
3. A variable name in C cannot start with?
A. a number
B. an alphabet
C. a capital character
D. None of the above
4. C programming language is
A. object oriented programming language
B. Procedure oriented programming language
C. function oriented programming language
D. None of above
5. const int width=100;
Regarding the above statement which of the statements is true?
A. Declares a variable width initialized as 100
B. Declares a construction with initialized as 100
C. Declares a integer type constant width with a fixed value of 100
D. Constructs an integer type variable with width a value 100
6. Every C program should compulsorily have a function called as:
A. start()
B. Start()
C. main()
D. Main()
7. Every program must have at least ______ function(s).
A. 1
B. 2
C. 3
D. None of the above
8. Find the output of the following C code:
#include<stdio.h>
#include<string.h>
void main()
{
int i=0;
for(;i<=2;)
printf("%d", ++i);
}
A. 0 1 2
B. 1 2 3
C. 0 1 2 3
D. Infinite Loop
9. Find the output of the following C program?
#include<stdio.h>
int main()
{
int x, y, z;
x = y = z = 1;
z = ++x || ++y && ++z;
printf("x=%d\t y=%d\t z=%d\n", x, y, z);
return 0;
}
A. x=2, y=1, z=1
B. x=2, y=2, z=1
C. x=2, y=2, z=2
D. x=1, y=2, z=1
10. Find the output of the following program
#include<stdio.h>
void main()
{
int a;
printf("%d", a^a);
}
A. 0
B. 1
C. infinite
D. Error
11. Find the output of the following program
#include<stdio.h>
void main()
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("1");
}
printf("\n");
}
}
A.
1
11
111
1111
11111
B. 1
11
111
1111
111111
1111111
C. 5
55
555
5555
555555
5555555
D.
1
1
1
1
1
12. Find the output of the following program
#include<stdio.h>
void main()
{
int x=500, y=100, z;
if(!x>=400)
y=300;
z=200;
printf("y=%d z=%d\n", y, z);
}
A. y=100 z=200
B. y=300 z=garbage
C. y=100 z=garbage
D. y=300 z=200
13. Find the output of the following program?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=4, z=12;
clrscr();
if(i==5 || z>50)
printf("\n Samosa");
else
printf("\n Dosa");
getch();
}
A. Samosa
B. Dosa
C. Error
D. None of the above
14. Find the output of the following program?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=4; clrscr();
printf("%d", i);
printf("\n%d", i--);
printf("\n%d", --i);
getch();
}
A. 4 4 2
B. 4 4 3
C. 4 4 4
D. 4 4 5
15. Find the output of the following program?
#include<stdio.h>
#include<conio.h>
void main()
{
int i=5;
if(i=0)
{
printf("I am Zero");
}
else
{
printf("I am Hero");
}
getch();
}
A. I am in Hero
B. I am in Zero
C. I am Hero
D. I am Zero
16. Find the output of the following program?
#include<stdio.h>
#include<conio.h>
void main()
{
int p=8, q=20;
if(p==5 && q>5)
printf("\n Why not C");
else
printf("\n Why C");
getch();
}
A. Why not C
B. Why C
C. Why not C and Why C
D. None
17. Find the output of the following program?
#include<stdio.h>
#include<conio.h>
void main()
{
int x=5, y;
y = x++;
printf("%d%d", x, y);
getch();
}
A. 6 5
B. 5 6
C. 6 6
D. 5 5
18. Find the output of the following program?
#include<stdio.h>
void main()
{
char *str="Hello world";
printf("%s", str);
}
A. Hello world
B. Error
C. Garbage value
D. None of the above
19. Find the output of the following program?
#include<stdio.h>
void main()
{
int x=0, y=0;
x=(y=75)+9;
printf("\n%d %d", x, y);
}
A. 75, 9
B. 75, 84
C. 84, 75
D. None of above
20. Find the output of the following program?
#include<stdio.h>
void main()
{
char letter=' ';
printf("\n%d", letter);
}
A. 32
B. 68
C. Error
D. Garbage Value
21. Find the output of the following program?
#include<stdio.h>
void main()
{char letter=' ';
printf("\\n%c" letter);}
A. ' '(Blank Space)
B. 65
C. Syntax Error
D. Garbage value
22. Find the output the following C program?
#include<stdio.h>
int main()
{
char x=65;
x=x+10;
printf("%d", x);
return 0;
}
A. 21
B. 18
C. 15
D. None of above
23. For an assignment statement
A. The left side value of the assignment operator must always be a variable
B. The right side value of the assignment operator might be a constant, a variable, an expression or any combination of these
C. The assignment always takes place from right to left and never the other way
D. All of above
24. How many times "C" is get printed?
#include<stdio.h>
void main()
{
int x;
for(x=0; x<=10; x++)
{
if(x<5)
continue;
else
break;
printf("C");
}
}
A. 5 Times
B. 11 Times
C. 0 Times
D. 10 Times
25. String is an array of characters terminated with _______
A. \n
B. \t
C. \0
D. \1
26. Suppose the following statements are written:
int i=9, j=6;
float x=0.5, y=0.5;
char a='a', b='b';
Find the values of the following expression
(3*i-2*j)%(2*a-b)
A. 10
B. 15
C. 11
D. 16
27. Suppose the following statements are written:
int i=9, j=6;
float x=0.5, y=0.5;
char a='a', b='b';
Find the values of the following expression
(x>y) && (i>0) && (j>5)
A. -1
B. 0
C. 1
D. 2
28. The "return 0" statement in main function indicates
A. The program did nothing i.e. completed zero tasks
B. The program will be executed without any error
C. The program has not yet completed the execution
D. None of the above
29. The 10th element of an array "a" can be accessed as
A. a[10]
B. a[11]
C. a[9]
D. a[8]
30. The actual and formal parameters are ________
A. same variables with different names
B. different variable name with same memory location
C. different memory location with different variable names
D. different memory location with same or different names
31. The ASCII value of the null character stored at the end of the string is ________
A. 65
B. 97
C. 0
D. None of the above
32. The break statement is used to exit from a
A. DO loop
B. FOR loop
C. SWITCH statement
D. All of the above
33. The C language has been developed at
A. AT & T Bell Labs
B. IBM
C. Borland International
D. Sun Microsystems
34. The continue statement is used to:
A. resume the program when it is hanged
B. resume the program if a break statement is given
C. skips the rest of the loop in current iteration
D. none of the above
35. The default standard output device for C programs is
A. Modem
B. Monitor
C. Disk
D. Printer
36. The diagrammatic flow of the program is represented by
A. Flowchart
B. Program map
C. Pseudo code
D. Water fall mode
37. The escape sequence "\b" is a
A. back space
B. next line
C. tab
D. none of the above
38. The header file that has various string functions like strcpy(), strcat(), etc. is
A. stdio.h
B. conio.h
C. string.h
D. math.h
39. The memory space allocated to the array declared as int a[10]; will be ______ bytes in 16 bit System.
A. 10
B. 20
C. 30
D. 40
40. The memory space taken for a float type data is
A. 2 bytes
B. 4 bytes
C. 8 bytes
D. 10 bytes
41. The memory space taken for a int type data is in 16 bit System
A. 2 bytes
B. 4 bytes
C. 8 bytes
D. 10 bytes
42. The memory space taken for a long int type data is
A. 2 bytes
B. 4 bytes
C. 12 bytes
D. 10 bytes
43. The preprocessor directive in "C" programming language begins with
A. Hashsign(#)
B. Backslash and asterisk(/*)
C. Less than symbol (<)
D. Two backslash (//)
44. The programming language that closely resembles the machine language is
A. High-level languages
B. C Language
C. FORTRAN
D. Assembly Language
45. The prototype of a function can be written
A. only outside a function
B. only inside a function
C. both inside and outside a function
D. only with prefix #
46. The result of relational operator is always
A. either true or false
B. either less than or more than
C. either equal, less or more
D. None of the above
47. The return type of a function that does not have any return type is declared
A. long
B. double
C. void
D. int
48. The starting index of an array is always ____________.
A. 0
B. 1
C. 2
D. none
49. The value returned by a function is returned to the
A. main function
B. Operating System
C. caller function
D. called function
50. To accept a string from user, which of the following is used?
A. getchar()
B. putchar()
C. gets()
D. puts()
51. To perform one of the many operations selected based on a condition, which kind of statement will be required?
A. Iterative
B. Selective
C. Either a or b can be used
D. None of the above
52. To repeat a set of statements for 25 times, which kind of statement will be required?
A. Iterative
B. Selective
C. Either a or b can be used
D. None of the above
53. Variable name in C cannot start with?
A. a number
B. an alphabet
C. a capital character
D. None of above
54. What is a program
A. A set of sequencial instruction
B. A set of Data
C. A set of Record
D. All of above
55. What is the error in following code?
if(z=100)
printf("z is 100");
A. 100 should be written in double quotations in the first line
B. variable z should be inside double quotations in the first line
C. Mistakes in the equals to operator
D. There is no semicolon (;) at the end of first line
56. What is the function from where C programs begins their execution?
A. start()
B. begin()
C. main()
D. program()
57. What is the maximum value that an signed integer constant can have?
A. 32768
B. 32767
C. 1.7014e+38
D. 256
58. What is the only function all programs must contain?
A. start()
B. system()
C. main()
D. program()
59. What is the output following C program?
#include<stdio.h>
int main()
{
int k,num=30;
k=(num < 10) ? 100:200;
printf("%d %d", num, k);
return 0;
}
A. 200 30
B. 30 200
C. 100 200
D. 500 500
60. What is the output of the above program code?
#include<stdio.h>
void main()
{
int i=3, *p, **p1;
p=&i;
p1=&p;
printf("%d %d %d", *p, **p1, *(*p1));
}
A. 4 4 4
B. 0
C. 333
D. 433
61. What punctuation is used to indicate the start and end of code blocks?
A. {and}
B. <and>
C. [and]
D. (and)
62. What value must be returned to the operating system on the successful completion of a program?
A. 0
B. -1
C. 1
D. Programs should not return a value
63. What will be stored in the variable "ch" if we write the statement char ch='z'?
A. ASCII value of Z
B. Z along with the single inverted commas
C. The character Z
D. None of above
64. When an array is passed to a function, it can said that ________ is passed
A. Address of the array
B. Value of the first element of the array
C. Address of the first element of the array
D. Number if elements in the array
65. When following code is executed, what will be the values of a and b?
b=3;
a=b++;
printf("\nb=%d", a);
printf("\na=%d", b);
A. a contains 3 and b contains 4
B. a contains 4 and b contains 4
C. a contains 4 and b contains 3
D. a contains 3 and b contains 3
66. Which is the Boolean operator logical AND?
A. &
B. |
C. &&
D. ||
67. Which of the following cannot be used in identifiers?
A. Letters
B. Spaces
C. Underscore
D. Digits
68. Which of the following identifier is correct
A. Simple_Int
B. void
C. #3_friends
D. 3 friends
69. Which of the following identifier is incorrect
A. Int
B. INT
C. inte
D. int
70. Which of the following identifier is incorrect?
A. int_
B. 34_
C. son_
D. s1_
71. Which of the following is an escape sequence
A. \w
B. \e
C. \t
D. \g
72. Which of the following is false for a "switch" statement in C?
A. break statement is compulsory after each case
B. default statement is compulsory
C. There is a limit on the maximum number of cases
D. All of above
73. Which of the following is not a keyword
A. void
B. int
C. main
D. for
74. Which of the following is not a type of computer programming language?
A. Natural Language
B. Machine Language
C. High-level Languages
D. Binary Languages
75. Which of the following is not a valid escape code?
A. \t
B. \w
C. \v
D. \n
76. Which of the following is not an escape sequence
A. \n
B. \b
C. \c
D. \a
77. Which of the following is the correct way of writing comments?
A. */comments/*
B. /*comment*/
C. **comment**
D. {comment}
78. Which of the following special symbol allowed in a variable name?
A. _
B. *
C. -
D. !
79. Which of the following special symbol allowed in an identifier?
A. *(asteric)
B. _ (underscore)
C. - (hyphen)
D. | (pipeline)
80. Which of the following variable declaration is correct?
A. int length
B. char int
C. int long
D. All
81. Which of the following will not increase the value of variable c by 1?
A. c++;
B. c=c+1;
C. c+1>=c
D. c+=1
82. Which of the following will not valid expressions in C?
A. a=2+(b=5);
B. a=b=c=5;
C. a=11%3
D. b+5=2
83. Which of the is not an escape sequence
A. \\
B. \?
C. \'
D. \;
84. Which OS (Operating System) supports C?
A. DOS only
B. Linux only
C. Window only
D. All of the above
85. Which relational operator is used for comparison?
A. =
B. ==
C. equal
D. =
86. Which will be the output of following program?
#include<stdio.h>void main(){ int x=10, y=20, z=5, i; i = x < y < z;printf("%d\n", i);}
A. 0
B. 1
C. Error
D. None of Above
$floatBtn