0% found this document useful (0 votes)
2K views72 pages

Programming in

This document contains a multiple choice quiz on programming in C. There are 43 questions testing knowledge of topics like: who invented C, features of high-level and low-level languages, C operators, conditional statements like if/else, operator precedence, and more. The questions are in a multiple choice format with a single correct answer listed for each.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
0% found this document useful (0 votes)
2K views72 pages

Programming in

This document contains a multiple choice quiz on programming in C. There are 43 questions testing knowledge of topics like: who invented C, features of high-level and low-level languages, C operators, conditional statements like if/else, operator precedence, and more. The questions are in a multiple choice format with a single correct answer listed for each.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 72

PROGRAMMING IN C ASSIGNMENT

SAKTHI COLLEGE OF ART'S AND


SCIENCE FOR WOMEN'S
ODDANCHATHIRAM

DEPARTMENT OF COMPUTER
SCIENCE

I B.sc Computer Science

Multiple choice questions

maximum mark 300×1 =300

PRAT -A

I. Answer the following question

1) Who invented C Language.?

A) Charles Babbage
B) Grahambel
C) Dennis Ritchie
D) Steve Jobs

Answer : C

2) C Language is a successor to which language.?

A) FORTRAN
B) D Language
C) BASIC
D) B Language
Answer : D

3) C is a which level language.?

A) Low Level
B) High Level
C) Low + High
D) None

Answer : B

4) Low level language is .?

A) Human readable like language.


B) language with big program size.
C) language with small program size.
D) Difficult to understand and readability is questionable.

Answer : D

5) High level language is a .?

A) Human readable like language.


B) language with small program size.
C) language with big program size.
D) language which is difficult to understand and not human readable

Answer: A

6) Which program outputs "Hello World.." .?

A)
main()
{
scanf("Hello World..");
}

B)
main()
{
printf("Hello World..");
}

C)
main()
{
print("Hello World..");
}
D)
main()
{
scan("Hello World..");
}

Answer : B

7) C is _______ type of programming language.?


A) Object Oriented
B) Procedural
C) Bit level language
D) Functional
Answer: B

8) What is the present C Language Standard.?

A) C99 ISO/IEC 9899:1999


B) C11 ISO/IEC 9899:2011
C) C05 ISO/IEC 9899:2005
D) C10 ISO/IEC 9899:2010

Answer: B

9) What are the new features of C11 or ISO IEC 9899 2011 standard.?

A) Type generic Macros, Static Assertions


B) Multi Threading, Anonymous Unions, quick_exit
C) Bounds Checking Interfaces, Anonymous Strurctures
D) All

Answer:D

10) C language was invented in which laboratories.?

A) Uniliver Labs
B) IBM Labs
C) AT&T Bell Labs
D) Verizon Labs

Answer:C

11) BCPL Language is also called..?

A) C Language
B) B Language
C) D Language
D) None

Answer: D

12) C language was invented to develop which Operating System.?

A) Android
B) Linux
C) Ubuntu
D) Unix

Answer: C

13) C language was invented in the year.?

A) 1999
B) 1978
C) 1972
D) 1990
Answer: D

14) C language is used in the development of .?

A) Databases
B) Graphic applications
C) Word Processors
D) All of the above

Answer: D

15) Choose a C Conditional Operator from the list.

A) ?:
B) :?
C) :<
D) <:

Answer : A

16) What is the other name for C Language ?: Question Mark Colon Operator.?

A) Comparison Operator
B) If-Else Operator
C) Binary Operator
D) Ternary Operator

Answer: D

17) Choose a syntax for C Ternary Operator from the list.

A) condition ? expression1 : expression2


B) condition : expression1 ? expression2
C) condition ? expression1 < expression2
D) condition < expression1 ? expression2

Answer: A

18) What is the output of the C statement.?

int main()
{
int a=0;
a = 5<2 ? 4 : 3;
printf("%d",a);

return 0;
}
A) 4
B) 3
C) 5
D) 2

Answer: B

19) What is the output of C Program.?

int main()
{
int a=0;
a = printf("4");
printf("%d",a);

return 0;
}
A) 04
B) compiler error
C) 40
D) 41

Answer: D

20) What is the output of the C Program.?

int main()
{
int a=0;
a = 5>2 ? printf("4"): 3;
printf("%d",a);

return 0;
}
A) compiler error
B) 14
C) 41
D) 0

Answer :C

21) What is the output of the C Program.?

int main()
{
int a=0;
a = (5>2) ? : 8;
printf("%d",a);

return 0;
}
A) 0
B) 1
C) 8
D) compiler error

Answer: B

22) what is the output of c program.?

int main()
{
int a=0, b;
a = (5>2) ? b=6: b=8;
printf("%d %d",a, b);

return 0;
}
a) 6 6
b) 0 6
c) 0 8
d) compiler error

Answer:d

23) choose a correct statement regarding c comparison operators.

a) (x == y) is x really equal to y.
(x != y) is x not equal to y.
b) (x < y) is x less than y
(x > y) is x greater than y
c) (x <= y) is x less than or equal to y.
(x >= y) is x greater than or equal to y
d) all the above

Answer: d

24) choose a statement to use c if else statement.

a) else if is compulsory to use with if statement.


b) else is compulsory to use with if statement.
c) else or else if is optional with if statement.
d) none of the above

Answer:c

25) choose a correct c statement using if conditional statement.

a)
if( condition )
{
//statements;
}

b)
if( condition )
{
//statements;
}
else
{
//statements;
}

c)
if( condition1 )
{
//statements;
}
else if( condition2)
{
//statements;
}
else
{
//statements;
}

d) all the above.

Answer: d

26) what is the output of the c program.?

int main()
{
if( 4 > 5 )
{
printf("hurray..\n");
}
printf("yes");

return 0;
}

a) yes
b) hurray..yes
c) hurray..yes
d) compiler error

Answer: a

27) what is the output of the c program.?

int main()
{
if( 4 > 5 )
printf("hurray..\n");
printf("yes");

return 0;
}

a) yes
b) hurray..yes
c) hurray..yes
d) no output

Answer:a

28) What is the output of the C Program.?


int main()
{
if( 10 < 9 )
printf("Hurray..\n");
else if(4 > 2)
printf("England");

return 0;
}

a) hurray..yes
b) hurray..yes
c) compiler error
d) none of the above
Answer : A

29) What is the output of the C Program.?

int main()
{
if( 4 < 5 )
printf("Hurray..\n");
printf("Yes");
else
printf("England")

return 0;
}

A) Hurray..Yes
B) Hurray..Yes
C) Compiler error
D) None of the above
Answer:C

30) What is the output of C Program.?

int main()
{
if( 10 > 9 )
printf("Singapore\n");
else if(4%2 == 0)
printf("England\n");
printf("Poland");
return 0;
}

A) Singapore
B) Singapore
Poland
C) Singapore
England
Poland
D) England
Poland

Answer: B

31) What is the output of the C Program.?

int main()
{
if(-5)
{
printf("Germany\n");
}
if(5)
{
printf("Texas\n");
}
printf("ZING");
return 0;
}

A) ZING
B) Texas
ZING
C) Germany
Texas
ZING
D) Compiler error as a number can not be put as condition inside IF.

Answer:C

32) What is the output of the C Program.?

int main()
{
if(10.0)
{
printf("Texas\n");
}
printf("ZING");

return 0;
}

A) ZING
B) Texas
ZING
C) Compiler error.
D) None of the above.

Answer:B

33) What is the output of C Program.?

int main()
{
if("abc")
{
printf("India\n");
}
if('c')
{
printf("Honey\n");
}
printf("ZING");

return 0;
}

A) ZING
B) Honey
ZING
C) India
ZING
D) India
Honey
ZING

Answer:D

34) What is the output of C Program.?

int main()
{
if(TRUE)
{
printf("India\n");
}
if(true)
{
printf("Honey\n");
}
printf("ZING");

return 0;
}

A) India
ZING
B) Honey
ZING
C) India
Honey
ZING
D) Compiler error

Answer:D

35) What is the Priority among (*, /, %), (+, -) and (=) C Operators.?

A) (*, /, %) > (+, -) < (=)


B) (*, /, %) < (+, -) < (=)
C) (*, /, %) > (+, -) > (=)
D) (*, /, %) < (+, -)
(+, -) == (=)

Answer:C

36) What is the output of the C statement.?

int main()
{
int a=0;
a = 4 + 4/2*5 + 20;
printf("%d", a);

return 0;
}

A) 40
B) 4
C) 34
D) 54

Answer:C
37) What is the output of the C Program.?

int main()
{
int a=0;
a = 10 + 5 * 2 * 8 / 2 + 4;
printf("%d", a);

return 0;
}

A) 124
B) 54
C) 23
D) 404

Answer:B

38) What is the output of the C Program.?

int main()
{
int a=0;
a = 4 + 5/2*10 + 5;
printf("%d", a);

return 0;
}

A) 29
B) 5
C) 4
D) 34

Answer:A

39) What is the output of the C Program.?

int main()
{
int a=0;
a = 10 + 2 * 12 /(3*2) + 5;
printf("%d", a);

return 0;
}

A) 31
B) 19
C) 11
D) 29

Answer :B

40) What is the output of the C Program.?


int main()
{
int a=0;
a = 10 + 2 * 12 / 3 * 2 + 5;
printf("%d", a);

return 0;
}

A) 19
B) 31
C) 11
D) 25

Answer :B

41) What is the output of the C Program.?

int main()
{
float a=10.0;
a = a % 3;
printf("%f", a);

return 0;
}

A) 0
B) 1
C) 1.000000
D) Compiler error.

Answer:D

42) What is the output of the C Program.?

int main()
{
float a=10.0;
a = (int)a % 3;
printf("%f", a);

return 0;
}

A) 0
B) 1
C) 1.000000
D) Compiler Error.

Answer:C

43) What is the output of the C Program.?

int main()
{
int a=0;
a = 14%-5 - 2;
printf("%d", a);

return 0;
}

A) 0
B) -4
C) -2
D) 2

Answer :D

44) What is the output of the C Program.?

int main()
{
int a= 3 + 5/2;
printf("%d", a);

return 0;
}

A) 3
B) 2
C) 5
D) Can not assign an expression to variable at the time of declaration.

Answer:C

45) We can insert pre written code in a C program by using

A)#read
B)#get
C)#include
D)#put

Answer: C

46) The first expression in a for loop is


Step value of loop

A.Value of the counter variable


B.Any of above
C.None of above
D.Answer And Explanation

Answer: Option B

47) Break statement is used for

A)Quit a program
B)Quit the current iteration
C)Both of above
D)None of above

Answer : C

48. Continue statement used for


A) To continue to the next line of code
B)To stop the current iteration and begin
C)the next iteration from the beginning
D)To handle run time error

Answer: Option B

49)What will be output of

#include
void main()
{
char test =`S`;
printf("\n%c",test);
}

A)S
B)Error
C)Garbage value
D)None of above

Answer: A

50. Due to variable scope in c

A)Variables created in a function cannot be used another function


B)Variables created in a function can be used in another function
C)Variables created in a function can only be used in the main function
D)None of above

Answer: A

51. What will be the output of following program

#include
main()
{
int x,y = 10;
x = y * NULL;
printf(\"%d\",x);
}

A)error
B)0
C)10
D)Garbage value

Answer: B

52) Identify wrong C Keywords below.

A) auto, double, int, struct


B) break, else, long, switch
C) case, enum, register, typedef
D) char, extern, intern, return
Answer:D

53) Identify wrong C Keywords below.

A) union, const, var, float


B) short, unsigned, continue, for
C) signed, void, default, goto
D) sizeof, volatile, do, if

Answer:A

54) Identify wrong C Keywords below.

A) static, while, break, goto


B) struct, construct, signed, unsigned
C) short, long, if, else
D) return, enum, struct, do

Answer:B

55) Find a correct C Keyword below.

A) breaker
B) go to
C) shorter
D) default

Answer:D

56) Find a correct C Keyword below.

A) work
B) case
C) constant
D) permanent

Answer:B

57) Find a correct C Keyword.

A) Float
B) Int
C) Long
D) double

Answer:D

58) Types of Integers are.?

A) short
B) int
C) long
D) All the above

Answer: D

59) Types of Real numbers in C are.?


A) float
B) double
C) long double
D) All the above

Answer:D

60) signed and unsigned representation is available for.?

A) short, int, long, char


B) float, double, long double
C) A & B
D) None of the above

Answer:C

61) Size of a Turbo C C++ compiler is.?

A) 16 bit
B) 32 bit
C) 64 bit
D) 128 bit

Answer: A

62) Size of a GCC or Visual Studio C Compiler is.?

A) 16 bit
B) 32 bit
C) 64 bit
D) 128 bit

Answer:B

63) Sizes of short, int and long in a Turbo C C++ compiler in bytes are.?

A) 2, 2, 4
B) 2, 4, 4
C) 4, 8, 16
D) 8, 8, 16

Answer:A

64) Sizes of short, int and long in Visual Studio or GCC compiler in bytes are.?

A) 2, 2, 4
B) 2, 4, 4
C) 4, 4, 8
D) 4, 8, 8

Answer:B

65) Range of signed char and unsigned char are.?

A) -128 to +127
0 to 255
B) 0 to 255
-128 to +127
C) -128 to -1
0 to +127
D) 0 to +127
-128 to -1

Answer:A

66) Ranges of signed int and unsigned int are.?

A) 0 to 65535
-32768 to +32767
B) -32768 to +32767
0 to 65535
C) -32767 to +32768
0 to 65536
D) 0 to 65536
-32767 to +32768

Answer: B

67) Size of float, double and long double in Bytes are.?

A) 4, 8, 16
B) 4, 8, 10
C) 2, 4, 6
D) 4, 6, 8

Answer:B

68) Range of singed long and unsigned long variables are.?

A) -2147483647 to +2147483648
0 to 4294967295
B) -2147483648 to +2147483647
0 to 4294967296
C) -2147483648 to +2147483647
0 to 4294967295
D) 0 to 4294967295
-2147483648 to +2147483647

Answer:C

69) Range of float variable is.?

A) -3.2e38 to +3.2e38
B) -3.8e32 to +3.8e32
C) -3.4e34 to +3.4e34
D) -3.4e38 to +3.4e38

Answer : D

70) Left most bit 0 in Singed representation indicates.?

A) A Positive number
B) A Negative Number
C) An Unsigned number
D) None of the above

Answer:A

71)How many keywords are there in c ?

A. 31
B. 32
C. 64
D. 63

Answer : B

72) Which of the following is true for variable names in C?

A. Variable names cannot start with a digit


B. Variable can be of any length
C. They can contain alphanumeric characters as well as special characters
D. Reserved Word can be used as variable name

Answer : A

73. Which of the following cannot be a variable name in C?

A. TRUE
B. friend
C. export
D. volatile

Answer: A

74. What is the output of this program?

void main()
{
int x = 10;
float x = 10;
printf("%d", x)
}

A. Compilations Error
B. 10
C. 10
D. 10.1

Answer : A

75. What is the output of this program?

#include <stdio.h>
int main()
{
int i;
for (i = 0;i < 5; i++)
int a = i;
printf("%d", a);
}

A. Syntax error in declaration of a


B. No errors, program will show the output 5
C. Redeclaration of a in same scope throws error
D. a is out of scope when printf is called

Answer : A

76. What is the output of this program?

#include <stdio.h>
int var = 20;
int main()
{
int var = var;
printf("%d ", var);
return 0;
}

A. Garbage Value
B. 20
C. Compiler Error
D. None of these

Answer : A

77. What is the output of this program?

void main()
{
int p, q, r, s;
p = 1;
q = 2;
r = p, q;
s = (p, q);
printf("p=%d q=%d", p, q);
}

A. p=1 q=1
B. p=1 q=2
C. p=2 q=2
D. Invalid Syntex

Answer : B

78. What is the output of this program?

void main()
{
printf("%x",-1<<4);
}

A. fff0
B. fff1
C. fff2
D. fff3
Ans : A

79. What is the output of this program?

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

A. 11 3 5 11
B. 11 1 5 11
C. 11 3 2 11
D. 11 3 3 11

Ans : A

80. What is the output of this program?

void main()
{
int a, b = 5, c;
a = 5 * (b++);
c = 5 * (++b);
printf("%d %d",a,c);
}

A. 30 35
B. 30 30
C. 25 30
D. 25 35

Ans :D

81) The format identifier ‘%i’ is also used for _____ data type?

A. char
B. int
C. float
D. double

Answer : B

82) Comment on the output of this C code?

int main()
{
int a[5] = {1, 2, 3, 4, 5};
int i;
for (i = 0; i < 5; i++)
if ((char)a[i] == '5')
printf("%d\n", a[i]);
else
printf("FAIL\n");
}
A. The compiler will flag an error
B. Program will compile and print the output 5
C. Program will compile and print the ASCII value of 5
D. Program will compile and print FAIL for 5 times

Answer:D

83). Which data type is most suitable for storing a number 65000 in a 32-bit
system?

A. short
B. int
C. long
D. double

Answer :A

84. Which of the following is a User-defined data type?

A. typedef int Boolean;


B. typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;
C. struct {char name[10], int age};
D. All of the mentioned

Answer:D

85. What is the size of an int data type?

A. 4 Bytes
B. 8 Bytes
C. Depends on the system/compiler
D. Cannot be determined.

Answer : C

86) What is the output of this C code?

int main()
{
char chr;
chr = 128;
printf("%d\n", chr);
return 0;
}

A. 128
B. - 128
C. Depends on the compiler
D. None of the mentioned

Answer: B

87. Comment on the output of this C code?

int main()
{
char c;
int i = 0;
FILE *file;
file = fopen("test.txt", "w+");
fprintf(file, "%c", 'a');
fprintf(file, "%c", -1);
fprintf(file, "%c", 'b');
fclose(file);
file = fopen("test.txt", "r");
while ((c = fgetc(file)) != -1)
printf("%c", c);
return 0;
}

A. a
B. Infinite loop
C. Depends on what fgetc returns
D. Depends on the compiler

Answer : A

88) What is short int in C programming?

A. Basic data type of C


B. Qualifier
C. short is the qualifier and int is the basic datatype
D. All of the mentioned.

Answer:C

89. Comment on the output of this C code?

int main()
{
float f1 = 0.1;
if (f1 == 0.1)
printf("equal\n");
else
printf("not equal\n");
}

A. equal
B. not equal
C. Output depends on compiler
D. None of the mentioned

Answer :B

90. Comment on the output of this C code?

int main()
{
float f1 = 0.1;
if (f1 == 0.1f)
printf("equal\n");
else
printf("not equal\n");
}

A. equal
B. not equal
C. Output depends on compiler
D. None of the

Answer: A

91) What is the output of this C code (on a 32-bit machine)?

int main()
{
int x = 10000;
double y = 56;
int *p = &x;
double *q = &y;
printf("p and q are %d and %d", sizeof(p), sizeof(q));
return 0;
}

A. p and q are 4 and 4


B. p and q are 4 and 8
C. Compiler error
D. p and q are 2 and 8

Answer:A

92) Which is correct with respect to size of the datatypes?

A. char > int > float


B. int > char > float
C. char < int < double
D. double > char > int

Answer : C

93) What is the output of the following C code(on a 64 bit machine)?

union Sti
{
int nu;
char m;
};
int main()
{
union Sti s;
printf("%d", sizeof(s));
return 0;
}

A. 8
B. 5
C. 9
D. 4

Answer : D

94) What is the output of this C code?

int main()
{
float x = 'a';
printf("%f", x);
return 0;
}

A. a
B. run time error
C. a.0000000
D. 97.000000

Answer : D

95) Which of the datatypes have size that is variable?

A. int
B. struct
C. float
D. double

Answer: B

96) Name the loop that executes at least once.

A.For
B.If
C.do-while
D.while

Answer : C

97) Far pointer can access _____

A.Single memory location


B.No memory location
C.All memory location
D.First and Last Memory Address

Answer : C

98) A pointer pointing to a memory location of the variable even after deletion of
the variavle is known as _____

A.far pointer
B.dangling pointer
C.null pointer
D.void pointer

Answer : B

99)An uninitialized pointer in C is called ___

A.Constructor
B.dangling pointer
C.Wild Pointer
D.Destructor

Answer : C

100)A pointer that is pointing to NOTHING is called ____


A.VOID Pointer
B.DANGLING Pointer
C.NULL Pointer
D.WILD Pointer

Answer :C

101) Comment on the given statment:

scanf("%d",i);

A. Will execute without any error


B. Will give Segmentation fault
C. Will give Compilation Error
D. None of the above

Answer: B

102)What is the output of this C code?

int main()
{
int i = -5;
int k = i %4;
printf("%d\n", k);
}

A. Compile time error


B. -1
C. 1
D. None

Answer: B

103) What is the output of this C code?

int main()
{
int i = 5;
int l = i / -4;
int k = i % -4;
printf("%d %d\n", l, k);
return 0;
}

A. Compile time error


B. -1 1
C. 1 -1
D. Run time error

Answer : B

104) What is the output of this C code?

int main()
{
int i = 7;
i = i / 4;
printf("%d\n", i);
return 0;
}
A. Run time error
B. 1
C. 3
D.Compile time error

Answer: B

105. What is the value of x in this C code?

void main()
{
int x = 4 *5 / 2 + 9;
}

A. 6.75
B. 1.85
C. 19
D. 3

Answer: C

106. What is the output of this C code?

void main()
{
int x = 4.3 % 2;
printf("Value of x is %d", x);
}

A. Value of x is 1.3
B. Value of x is 2
C. Value of x is 0.3
D. Compile time error

Answer: D

107)What is the Priority among (*, /, %), (+, -) and (=) C Operators.?

A) (*, /, %) > (+, -) < (=)


B) (*, /, %) < (+, -) < (=)
C) (*, /, %) > (+, -) > (=)
D) (*, /, %) < (+, -)
(+, -) == (=)

Answer: C

108) What is the output of the C statement.?

int main()
{
int a=0;
a = 4 + 4/2*5 + 20;
printf("%d", a);

return 0;
}

A) 40
B) 4
C) 34
D) 54

Answer:C

109) What is the output of the C Program.?

int main()
{
int a=0;
a = 10 + 5 * 2 * 8 / 2 + 4;
printf("%d", a);

return 0;
}

A) 124
B) 54
C) 23
D) 404

Answer:B

110) What is the output of the C Program.?

int main()
{
int a=0;
a = 4 + 5/2*10 + 5;
printf("%d", a);

return 0;
}

A) 29
B) 5
C) 4
D) 34

Answer:A

111) What is the output of the C Program.?

int main()
{
int a=0;
a = 10 + 2 * 12 /(3*2) + 5;
printf("%d", a);

return 0;
}
A) 31
B) 19
C) 11
D) 29

Answer:B

112) What is the output of the C Program.?

int main()
{
int a=0;
a = 10 + 2 * 12 / 3 * 2 + 5;
printf("%d", a);

return 0;
}

A) 19
B) 31
C) 11
D) 25

Answer:B

113) What is the output of the C Program.?

int main()
{
float a=10.0;
a = a % 3;
printf("%f", a);

return 0;
}

A) 0
B) 1
C) 1.000000
D) Compiler error.

Answer:D

114) What is the output of the C Program.?

int main()
{
float a=10.0;
a = (int)a % 3;
printf("%f", a);

return 0;
}

A) 0
B) 1
C) 1.000000
D) Compiler Error.
Answer:C

115) What is the output of the C Program.?


int main()
{
int a=0;
a = 14%-5 - 2;
printf("%d", a);

return 0;
}

A) 0
B) -4
C) -2
D) 2

Answer: D

116) What is the output of the C Program.?


int main()
{
int a= 3 + 5/2;
printf("%d", a);

return 0;
}
A) 3
B) 2
C) 5
D) Can not assign an expression to variable at the time of declaration.

Answer:C

117)What is the following code segment doing?

void fn( )
{
char c;
cin.get(c);
if (c != ‘\n’)
{
fn( );
cout.put(c);
}
}

A. The string entered is printed as it is.


B. The string entered is printed in reverse order.
C. It will go in an infinite loop.
D. It will print an empty line.

Answer: B

118) For loop in a C program, if the condition is missing

A. it is assumed to be present and taken to be false


B. it is assumed to be present and taken to the true
C. it result in a syntax error
D. execution will be terminated abruptly

Answer :B

119) Which of the following statement about for loop is true ?


A. Index value is retained outside the loop
B. Index value can be changed from within the loop
C. Goto can be used to jump, out of the loop
D. All of these

Answer: D

1)If c is a variable initialised to 1, how many times will the following loop be
executed?

while ((c > 0) && (c < 60))


{
loop body
c ++;
}

A. 60
B. 59
C. 61
D. None of these

Answer : B

120)How many times will the following loop be executed if the input data item is 0
1 2 3 4 ?

while (c = getchar ()! = 0)


{ }

A. Ininition
B. never
C. once
D. None of these

Answer: A

121) Which of the following is branching statement of C language?

A. if statement
B. if…else statement
C. switch statement
D. All of these

Answer: D

122) ____________ is the built in multiway decision statement in C.

A. for
B. switch
C. if
D. while

Answer: B

123)The default case is compulsory in the switch case statement.

A. True
B. False
C. None of these

Answer: B

124) if and switch statements are examples of control statements in C.

A. True
B. False
C. None of these

Answer: A

125) Case label in switch statement must be constants only.

A. True
B. False

Answer: B

126)The break statement is optional in the switch-case statement

A. True
B. False
C. None of these

Answer: A

127)It is not permitted to nest a switch statement

A. True
B. False
C. None of these

Answer: B

128)A program stops its execution when break statement is encountered.

A. True
B. False
C. None of these

Answer: B

129)If the Boolean expression of if statement evaluates to ________, then the block
of code inside the if statement will be executed.

A. True
B. False
C. None of these
Answer: A
130)C programming language assumes any non-zero and non-null values as true.

A. Statement is True
B. Statement is False

Answer: A

131)1) An Array in Java is a collection of elements of ___ data type.

A) Same
B) Different
C) -
D) -

Answer:A

132) The Java Virtual Machine (JVM) implements arrays as ___ type.

A) Primitive
B) Object
C) -
D) -

Answer:B

133) Unlike C-Arrays, the Java-Arrays have ___.

A) Names
B) Values
C) Methods and Fields
D) None

Answer:C

134) An array declaration in Java without initialization ___ memory.

A) Does not allocate


B) Allocates memory
C) -
D) -

Answer:A

135) In Java language, an array index starts with ___.

A) -1
B) 0
C) 1
D) Any integer

Answer:B

136) Which are the special symbols used to declare an array in Java?

A) Braces { }
B) Parentheses ()
C) Square Brackets [ ]
D) Angled Brackets < >
Answer:C

137) Which are the special symbols used to initialize an array at the time of the
declaration itself?

A) Parentheses ( )
B) Square Brackets [ ]
C) Braces { }
D) Angled Brackets < >

Answer:C

138) It is possible to skip initializing some elements of the array during


Shorthand Initialization. (TRUE / FALSE)

A) FALSE
B) TRUE
C) -
D) -

Answer:A

139) In Java, an array can be declared without initialization without mentioning


the size. (TRUE / FALSE)

A) TRUE
B) FALSE
C) -
D) -

Answer:A

140) What is the output of the below Java code snippet with arrays?

static int[] nums;


public static void main(String args[])
{
System.out.println(nums.length);
}

A) 0
B) null
C) Compiler error
D) Runtime Exception - Null Pointer Exception

Answer:D

141) What is the output of the below Java program?

int[] marks = {35,65,95};


System.out.print(marks.length + "," + marks[1]);

A) 2,65
B) 3,95
C) 3,65
D) Compiler error

Answer:C

142) What is the output of the below Java code snippet?

int[] balls = {};


System.out.print(balls.length);

A) 0
B) -1
C) 1
D) Compiler error

Answer:A

143) Which is the correct way of knowing Array Size in Java?

A)
//int[] ary;
ary.length()
B)
//int[] ary;
ary.length
C)
//int[] ary;
ary->length()
D)
//int[] ary;
ary->length

Answer:B

144) What is the output of the below Java program with arrays?

String[] colors = {"RED";"YELLOW";"WHITE"};


System.out.print(colors[2]);

A) RED
B) YELLOW
C) WHITE
D) Compiler error

Answer:

145) What is the output of the below Java program with arrays?

public class Polo {


public static void main(String args[])
{
String[] computer = {"RAM","HDD","MOUSE"};
String[] parts = {computer[0],computer[2]};
System.out.print(parts[1]);
}
}

A) RAM
B) HDD
C) MOUSE
D) Compiler error

Answer:C

146) What is the output of the below Java program?

int ages[3] = {25, 27, 30};


System.out.println(ages[1]);

A) 25
B) 27
C) 30
D) Compile error

Answer:D

147) We should not specify the array size if declaration and initialization are
done at the same time. (TRUE / FALSE)

A) FALSE
B) TRUE
C) -
D) -

Answer:B

148) If an index of an element is N, what is its actual position in the array?

A) N-1
B) N
C) N+1
D) N+2

Answer:C

149) An array in Java can be declared only of some predefined types. (TRUE/FALSE)

A) FALSE
B) TRUE
C) -
D) -

Answer:A

150) The name of an array variable or identifier can start with ___.

A) A letter
B) Underscore ( _ )
C) Dollar Symbol ($)
D) All

Answer:D

151) Shorthand array initialization in Java needs the keyword "new" to allocate
memory to the array and elements. State TRUE or FALSE.
A) FALSE
B) TRUE
C) -
D) -

Answer:A

152) Lazy initialization of array requires the keyword "new" to allocate memory to
the array and its elements. State TRUE or FALSE.

A) FALSE
B) TRUE
C) -
D) -

Answer:B

153) What is the default value of an element of Object type array?

A) 0
B) null
C) -1
D) Garbage value

Answer:B

154) What is the default value of byte, short, int or long data type elements of an
array in Java?

A) -1
B) 1
C) 0
D) Garbage value

Answer:C

155) What is the default value of float or double data type elements of an array in
Java?

A) 0
B) 0.0
C) 1
D) 1.0

Answer:B

156) What is the default value of a char data type elements of an array in Java?

A) 'A'
B) '\0'
C) null
D) '\0' or null

Answer: D

157) What is the default value of boolean data type elements of an array in Java?
A) true
B) false
C) -
D) -

Answer:B

158) Allocating memory with the keyword "new" causes the array elements to carry
default values. State TRUE or FALSE.

A) FALSE
B) TRUE
C) -
D) -

Answer:B

159) What is the output of the below Java program?

int balls[], rounds=3;


balls = new int[rounds];
for(int i=0; i<balls.length; i++)
balls[i] = (i+1)*2;
for(int j=0; j<balls.length; j++)
System.out.print(balls[j] + ",");

A) 0,2,4,
B) 1,2,3,
C) 2,4,6,
D) Compiler error

Answer:C

160) What is the output of the below Java program with arrays?

String[] ary = {"KITE", "AIR"};


String str = "PLANE";
ary[1] = str;
str = "FLY";
System.out.println(ary[1]);

A) AIR
B) PLANE
C) FLY
D) Compiler error

Answer:B

161) An array of arrays in Java is called ___ array.

A) Bidirectional
B) Combo
C) Multidimensional
D) Multi-valu
Answer:C

162) A multidimensional array contains elements of the same data-type in all rows
and columns. State TRUE or FALSE.
A) FALSE
B) TRUE
C) -
D) -
Answer:C

163) An array of dimension N contains __ number of subscripts or brackets?

A) N-1
B) N
C) N+1
D) 10*N

Answer:B

164) An array with two dimensions is called a two-dimensional array in Java. State
TRUE or FALSE.

A) TRUE
B) FALSE
C) -
D) -

Answer:A

165) Row number and Column number in a Multidimensional array start with ___.

A) -1
B) 0
C) 1
D) 2

Answer:B

166) A 4-dimensional array is an array of ___ dimensional arrays.

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

Answer:B

167) Choose the correct way of initializing a multidimensional array below.

A)
int[][] code = {{1,2},{3,4,5}};
B)
int[2][] code = {{1,2},{3,4,5}};
C)
int[][] code={1,2,
3,4,5};
D) All

Answer:A
168) What is the output of the Java program with the multidimensional array?

int[][] goats;
goats = new int[3][];
goats[0] = {1,2};
System.out.println(goats[0][1]);

A) 0
B) 1
C) 2
D) Compiler error

Answer:D

169) State TRUE or FALSE. In a multidimensional array, the number of Columns in


each Row can be different.

1
2 3
4 5 6

A) FALSE
B) TRUE
C) -
D) -

Answer:B

170) While mentioning the array size in a multidimensional array using the new
keyword, the left-most script is mandatory. State TRUE or FALSE.

int ary[][];
ary = new int[5][];//first dimension is compulsory.

A) FALSE
B) TRUE
C) -
D) -

Answer: A

171)Which among the following is Copying function?

a) memcpy()
b) strcopy()
c) memcopy()
d) strxcpy()

Answer: a

172. Which function will you choose to join two words?

a) strcpy()
b) strcat()
c) strncon()
d) memcon()
Answer: b

173. The ______ function appends not more than n characters.

a) strcat()
b) strcon()
c) strncat()
d) memcat()

Answer: c

174. What will strcmp() function do?

a) compares the first n characters of the object


b) compares the string
c) undefined function
d) copies the string

Answer: b

175. What is the prototype of strcoll() function?

a) int strcoll(const char *s1,const char *s2)


b) int strcoll(const char *s1)
c) int strcoll(const *s1,const *s2)
d) int strcoll(const *s1)

176. What is the function of strcoll()?

a) compares the string, result is dependent on the LC_COLLATE


b) copies the string, result is dependent on the LC_COLLATE
c) compares the string, result is not dependent on the LC_COLLATE
d) copies the string, result is not dependent on the LC_COLLATE

Answer: a

177) Which of the following is the variable type defined in header string. h?

a) sizet
b) size
c) size_t
d) size-t

Answer: c

178. NULL is the macro defined in the header string. h.

a) true
b) false
Answer: a

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

const char pla[] = "string1";


const char src[] = "string2";
printf("Before memmove place= %s, src = %s\n", pla, src);
memmove(pla, src, 7);
printf("After memmove place = %s, src = %s\n", pla, src);

a) Before memmove place= string1, src = string2 After memmove place = string2, src
= string2

b) Before memmove place = string2, src = string2 After memmove place= string1, src
= string2

c) Before memmove place = string2, src = string1 After memmove place= string2, src
=string2

d) Before memmove place= string1, src = string2 After memmove place=string1, src =
string1

Answer: a

180) What will be the output of the following C code?

const char str1[]="ABCDEF1234567";


const char str2[] = "269";
len = strcspn(str1, str2);
printf("First matching character is at %d\n", len + 1);

a) First matching character is at 8


b) First matching character is at 7
c) First matching character is at 9
d) First matching character is at 12

Answer: a

181)What is a String in C Language.?

A) String is a new Data Type in C


B) String is an array of Characters with null character as the last element of
array.
C) String is an array of Characters with null character as the first element of
array
D) String is an array of Integers with 0 as the last element of array.

Answer:B

182) Choose a correct statement about C String.


char ary[]="Hello..!";

A) Character array, ary is a string.


B) ary has no Null character at the end
C) String size is not mentioned
D) String can not contain special characters.
Answer:A

183) What is the Format specifier used to print a String or Character array in C
Printf or Scanf function.?

A) %c
B) %C
C) %s
D) %w

Answer:C

184) What is the output of C Program with Strings.?

int main()
{
char ary[]="Discovery Channel";
printf("%s",ary);
return 0;
}

A) D
B) Discovery Channel
C) Discovery
D) Compiler error

Answer:B

185) What is the output of C Program with Strings.?

int main()
{
char str[]={'g','l','o','b','e'};
printf("%s",str);
return 0;
}

A) g
B) globe
C) globe\0
D) None of the above

Answer:D

186) What is the output of C Program with Strings.?

int main()
{
char str[]={'g','l','o','b','y','\0'};
printf("%s",str);
return 0;
}

A) g
B) globe
C) globe\0
D) Compiler error

Answer:B

187) How do you convert this char array to string.?


char str[]={'g','l','o','b','y'};

A) str[5] = 0;
B) str[5] = '\0'
C) str[]={'g','l','o','b','y','\0'};
D) All the above

Answer:D

188) What is the output of C Program.?

int main()
{
int str[]={'g','l','o','b','y'};
printf("A%c ",str);
printf("A%s ",str);
printf("A%c ",str[0]);
return 0;
}

A) A A A
B) A Ag Ag
C) A*randomchar* Ag Ag
D) Compiler error

Answer:C

189) What is the output of C Program with arrays.?

int main()
{
char str[]={"C","A","T","\0"};
printf("%s",str);
return 0;
}

A) C
B) CAT
C) CAT\0
D) Compiler error

Answer:D

190) What is the maximum length of a C String.?

A) 32 characters
B) 64 characters
C) 256 characters
D) None of the above

Answer:D
191) What is the output of C program with strings.?

int main()
{
char str1[]="JOHN";
char str2[20];
str2= str1;
printf("%s",str2);
return 0;
}

A) JOHN
B) J
C) JOHN\0
D) Compiler error

Answer:D

192) What is the output of C Program with arrays.?

int main()
{
char str[25];
scanf("%s", str);
printf("%s",str);
return 0;
}
//input: South Africa

A) South
B) South Africa
C) S
D) Compiler error

Answer:A

193) What is the output of C program with strings.?

int main()
{
char str[2];
scanf("%s", str);
printf("%s",str);
return 0;
}
//Input: South

A) So
B) South
C) Compiler error
D) None of the above

Answer:B
194) What is the output of C Program with strings.?

int main()
{
char str[2];
int i=0;
scanf("%s", str);
while(str[i] != '\0')
{
printf("%c", str[i]);
i++;
}
return 0;
}
//Input: KLMN

A) KL
B) KLMN
C) Compiler error
D) None of the above

Answer:B

195)How do you accept a Multi Word Input in C Language.?

A) SCANF
B) GETS
C) GETC
D) FINDS

Answer:B

196) Choose a correct C Statement about Strings.

A) PRINTF is capable of printing a multi word string.


B) PUTS is capable of printing a multi word string.
C) GETS is capable of accepting a multi word string from console or command prompt
D) All the above

Answer:D

197)What is the output of C Program with String Pointers.?

int main()
{
char *p1 = "GOAT";
char *p2;
p2 = p1;
printf("%s", p2);
}

A) G
B) GOAT
C) Compiler error
D) None of the above

Answer:B

198 How do you convert this char array to string.?


char str[]={'g','l','o','b','y'};
A) str[5] = 0;
B) str[5] = '\0'
C) str[]={'g','l','o','b','y','\0'};
D) All the above

Answer: D

199)What is the output of C Program with String arrays.?

int main()
{
char *p1 = "GOAT";
char *p2;
p2 = p1;
p2="ANT";
printf("%s", p1);
}
A) ANT
B) GOAT
C) G
D) A

Answer: B

200) A string in C is

A.1-D Array of Character

B.2-D Array of Character

C.Any of i & ii

D.None of the above

Answer: A

201)Choose correct statement about Functions in C Language.

A) A Function is a group of c statements which can be reused any number of times.


B) Every Function has a return type.
C) Every Function may no may not return a value.
D) All the above.

Answer:D

202) Choose a correct statement about C Language Functions.

A) A function name can not be same as a predefined C Keyword.


B) A function name can start with an Underscore( _ ) or A to Z or a to z.
C) Default return type of any function is an Integer.
D) All the above.

Answer:D

203) Choose a correct statement about C Function.?


main()
{
printf("Hello");
}

A) "main" is the name of default must and should Function.


B) main() is same as int main()
C) By default, return 0 is added as the last statement of a function without
specific return type.
D) All the above

Answer:D

204) A function which calls itself is called a ___ function.

A) Self Function
B) Auto Function
C) Recursive Function
D) Static Function

Answer:C

205) What is the output of C Program with Functions.?

int main()
{

void show()
{
printf("HIDE");
}

show();

return 0;
}

A) No output
B) HIDE
C) Compiler error
D) None of the above

Answer:B

206) What is the output of C Program with functions.?

void show();

int main()
{
show();
printf("ARGENTINA ");
return 0;
}

void show()
{
printf("AFRICA ");
}

A) ARGENTINA AFRICA
B) AFRICA ARGENTINA
C) ARGENTINA
D) Compiler error

Answer:B

207) What is the output of C Program with functions.?

int main()
{
show();
printf("BANK ");
return 0;
}

void show()
{
printf("CURRENCY ");
}

A) CURRENCY BANK
B) BANK CURRENCY
C) BANK
D) Compiler error

Answer:D

208) How many values can a C Function return at a time.?

A) Only One Value


B) Maximum of two values
C) Maximum of three values
D) Maximum of 8 values

Answer:A

209) What is the output of a C program with functions.?

void show();

void main()
{
show();
printf("RAINBOW ");

return;
}

void show()
{
printf("COLOURS ");
}
A) RAINBOW COLOURS
B) COLOURS RAINBOW
C) COLOURS
D) Compiler error

Answer:B

210) What is the output of C Program.?


void show();

void main()
{
printf("PISTA ");
show();
}

void show()
{
printf("CACHEW ");
return 10;
}

A) PISTA CACHEW
B) CASHEW PISTA
C) PISTA CASHEW with compiler warning
D) Compiler error

Answer:C

211) What is the output of C Program with functions.?

int show();

void main()
{
int a;
printf("PISTA COUNT=");
a=show();
printf("%d", a);
}

int show()
{
return 10;
}

A) PISTA COUNT=
B) PISTA COUNT=0
C) PISTA COUNT=10
D) Compiler error

Answer:C

212) What is the output of C Program with functions.?

void main()
{
int a;
printf("TIGER COUNT=");
a=show();
printf("%d", a);
}

int show()
{
return 15;
return 35;
}

A) TIGER COUNT=15
B) TIGER COUNT=35
C) TIGER COUNT=0
D) Compiler error

Answer:A

213) What are types of Functions in C Language.?

A) Library Functions
B) User Defined Functions
C) Both Library and User Defined
D) None of the above

Answer:C

214) What is the output of C program with functions.?

int show();

void main()
{
int a;
a=show();
printf("%d", a);
}

int show()
{
return 15.5;
return 35;
}

A) 15.5
B) 15
C) 0
D) Compiler error

Answer:B

215) What is the output of C Program.?


int myshow(int);

void main()
{
myshow(5);
myshow(10);
}

int myshow(int b)
{
printf("Received %d, ", b);
}

A) Received 5, Received 10,


B) Received 10, Received 5,
C) Received 0, Received10,
D)Compiler error

Answer:A

216) What is the output of C Program with functions and pointers.?

int myshow(int);

void main()
{
int a=10;
myshow(a);
myshow(&a);
}

int myshow(int b)
{
printf("Received %d, ", b);
}

A) Received 10, Received 10,


B) Received 10, Received RANDOMNumber,
C) Received 10, Received RANDOMNumber, with a compiler warning
D) Compiler error

Answer:C

217) What is the output of C Program with functions and pointers.?

int myshow(int *);

void main()
{
int a=10;
myshow(&a);
}

int myshow(int *k)


{
printf("Received %d, ", *k);
}

A) Received RANDOMNumber,
B) Received 10,
C) Received 10,
D) Compiler error
Answer:C

218) What is the output of C Program with functions and pointers.?

void myshow(int *);

void main()
{
int a=10;
printf("%d ", a);
myshow(&a);
printf("%d", a);

void myshow(int *k)


{
*k=20;
}

A) 10 10
B) 20 20
C) 10 20
D) Compiler error

Answer:C

219) What is the output of C Program with functions.?

void myshow(int);

void main()
{
int a=10;
printf("%d ", a);
myshow(a);
printf("%d", a);

void myshow(int k)
{
k=20;
}

A) 10 10
B) 20 20
C) 10 20
D) Compiler error

Answer:A

220) Choose correct statements about C Language Pass By Value.

A) Pass By Value copies the variable value in one more memory location.
B) Pass By Value does not use Pointers.
C) Pass By Value protects your source or original variables from changes in outside
functions or called functions.
D) All the above

Answer:D

221) What is a structure in C language.?

A) A structure is a collection of elements that can be of same data type.


B) A structure is a collection of elements that can be of different data type.
C) Elements of a structure are called members.
D) All the above

Answer:D

222) What is the size of a C structure.?

A) C structure is always 128 bytes.


B) Size of C structure is the total bytes of all elements of structure.
C) Size of C structure is the size of largest element.
D) None of the above

Answer:B

223) What is the output of C program with structures.?

int main()
{
structure hotel
{
int items;
char name[10];
}a;
strcpy(a.name, "TAJ");
a.items=10;
printf("%s", a.name);
return 0;
}

A) TAJ
B) Empty string
C) Compiler error
D) None of the above

Answer:C

224) What is the output of C program.?

int main()
{
struct book
{
int pages;
char name[10];
}a;
a.pages=10;
strcpy(a.name,"Cbasics");
printf("%s=%d", a.name,a.pages);
return 0;
}

A) empty string=10
B) C=basics
C) Cbasics=10
D) Compiler error

Answer:C

225) Choose a correct statement about C structures.

A) Structure elements can be initialized at the time of declaration.


B) Structure members can not be initialized at the time of declaration
C) Only integer members of structure can be initialized at the time of declaraion
D) None of the above

Answer:B

226) Choose a correct statement about C structure.?

int main()
{
struct ship
{

};
return 0;
}

A) It is wrong to define an empty structure


B) Member variables can be added to a structure even after its first definition.
C) There is no use of defining an empty structure
D) None of the above

Answer:C

227) What is the output of C program.?

int main()
{
struct ship
{
int size;
char color[10];
}boat1, boat2;
boat1.size=10;
boat2 = boat1;
printf("boat2=%d",boat2.size);
return 0;
}

A) boat2=0
B) boat2=-1
C) boat2=10
D) Compiler error
Answer:C

228) What is the output of C program with structures.?

int main()
{
struct ship
{
char color[10];
}boat1, boat2;
strcpy(boat1.color,"RED");
printf("%s ",boat1.color);
boat2 = boat1;
strcpy(boat2.color,"YELLOW");
printf("%s",boat1.color);
return 0;
}

A) RED RED
B) RED YELLOW
C) YELLOW YELLOW
D) Compiler error

Answer:A

229) What is the output of C program with structures.?

int main()
{
struct tree
{
int h;
}
struct tree tree1;
tree1.h=10;
printf("Height=%d",tree1.h);
return 0;
}

A) Height=0
B) Height=10
C) Height=
D) Compiler error

Answer:B

230) Choose a correct statement about C structure elements.?

A) Structure elements are stored on random free memory locations


B) structure elements are stored in register memory locations
C) structure elements are stored in contiguous memory locations
D) None of the above.

Answer:C

231) A C Structure or User defined data type is also called.?


A) Derived data type
B) Secondary data type
C) Aggregate data type
D) All the above

Answer:D

232) What are the uses of C Structures.?

A) structure is used to implement Linked Lists, Stack and Queue data structures
B) Structures are used in Operating System functionality like Display and Input
taking.
C) Structure are used to exchange information with peripherals of PC
D) All the above

Answer:D

233) What is the output of C program with structures.?

int main()
{
struct tree
{
int h;
int w;
};
struct tree tree1={10};
printf("%d ",tree1.w);
printf("%d",tree1.h);
return 0;
}

A) 0 0
B) 10 0
C) 0 10
D) 10 10

Answer:C

234) What is the output of C program with structures.?

int main()
{
struct tree
{
int h;
int rate;
};
struct tree tree1={0};
printf("%d ",tree1.rate);
printf("%d",tree1.h);
return 0;
}

A) 0 0
B) -1 -1
C) NULL NULL
D) Compiler error
Answer:A

235) What is the output of C program.?

int main()
{
struct laptop
{
int cost;
char brand[10];
};
struct laptop L1={5000,"ACER"};
struct laptop L2={6000,"IBM"};
printf("Name=%s",L1.brand);
return 0;
}

A) ACER
B) IBM
C) Compiler error
D) None of the above

Answer:A

236) What is the output of C program with structures pointers.?

int main()
{
struct forest
{
int trees;
int animals;
}F1,*F2;
F1.trees=1000;
F1.animals=20;
F2=&F1;
printf("%d ",F2.animals);
return 0;
}

A) 0
B) 20
C) Compiler error
D) None of the above

Answer:C

237) What
int main()
{
struct bus
{
int seats;
}F1, *F2;
F1.seats=20;
F2=&F1;
F2->seats=15;
printf("%d ",F1.seats);
return 0;
}

A) 15
B) 20
C) 0
D) Compiler error

Answer:A

238) What is the output of C program with structure arrays.?

int main()
{
struct pens
{
int color;
}p1[2];
struct pens p2[3];
p1[0].color=5;
p1[1].color=9;
printf("%d ",p1[0].color);
printf("%d",p1[1].color);
return 0;
}

A) 5 5
B) 5 9
C) 9 5
D) Compiler error

Answer:B

239) What is the output of C program with structure array pointers.?

int main()
{
struct car
{
int km;
}*p1[2];
struct car c1={1234};
p1[0]=&c1;
printf("%d ",p1[0]->km);
return 0;
}

A) 0
B) 1
C) 1234
D) Compiler error

Answer:C
240) Choose a correct statement about C structures.

A) A structure can contain same structure type member.


B) A structure size is limited by only physical memory of that PC.
C) You can define an unlimited number of members inside a structure.
D) All the above.

Answer:D

241) What is the output of c program with structures.?

int main()
{
struct car
{int color;};
struct garage
{
struct car mycar[10];
}gar;
struct car c1={5};
gar.mycar[0]=c1;
printf("%d",gar.mycar[0]);
return 0;
}

A) NULL
B) 0
C) 5
D) Compiler error

Answer:C

242) What is the size of the below C structure in TurboC?

int main()
{
struct books{
int pages;
char str[4];
}b;
printf("%d",sizeof(b));
return 0;
}

A) 5
B) 6
C) 7
D) 8

Answer:B

243) What is the output of C program with Structure pointer in TurboC.?

int main()
{
struct books{
int pages;
char str[4];
}*ptr;
printf("%d",sizeof(ptr));
return 0;
}

A) 2
B) 6
C) 7
D) 8

Answer:B

244) In a nested structure definition, with country.state.district statement,


memeber state is actually present in the structure.? (COUNTY, STATE, DISTRICT
structures)

A) district
B) state
C) country
D) None of the above

Answer: A
245) What is actually passed if you pass a structure variable to a function.?

A) Copy of structure variable


B) Reference of structure variable
C) Starting address of structure variable
D) Ending address of structure variable

Answer:A

246) What is the output of C program with structures.?

void show(int,int);
int main()
{
struct paint{
int type;
int color;
}p;
p.type=1;
p.color=5;
show(p.type,p.color);
return 0;
}
void show(int a,int b)
{
printf("%d %d",a,b);
}

A) 1 1
B) 1 5
C) 5 1
D) Compiler error

Answer:B
247) What is the output of C program with structures.?

int main()
{
struct paint{
int type;
int color;
}p1, p2;
p1.type=1;
p1.color=5;
if(sizeof(p1)==sizeof(p2))
{
printf("SAME");
}
else
{
printf("DIFFERENT");
}
return 0;
}

A) SAME
B) DIFFERENT
C) Compiler error
D) None of the above

Answer:A

248) Choose a correct statement about C structures.

A) A structure enables display of folder structure in OS.


B) A structure enables erasing contents in a folder in OS.
C) A structure enables to detect and respond to mouse clicks.
D) All the above

Answer:D

249) Choose a correct statement about structure and array.?

A) An array stores only elements of same type. Accessing elements is easy.


B) A structure is preferred when different type elements are to be combined as a
single entity.
C) An array implementation has performance improvements to structure
D) All the above

Answer:D

250) What are the types of data allowed inside a structure.?

A) int, float, double, long double


B) char, enum, union
C) pointers and Same structure type members
D) All the above

Answer:D

251)Which of the following are themselves a collection of different data types?


A. String
B. Structure
C. Char
D. All of the mentioned

Answer: B

252. User-defined data type can be derived by___________.

A. struct
B. enum
C. typedef
D. All of the mentioned

Answer:D

253)Which of the following is not an operating system?

A.Windows
B. Linux
C.Oracle
D.DOS

Answer:C

254) What is the maximum length of the filename in DOS?

A. 4
B. 5
C. 8
D. 12

Answer: C

255) When was the first operating system developed?

A. 1948
B. 1949
C. 1950
D. 1951

Answer: C

256) When were MS windows operating systems proposed?

A.1994
B.1990
C.1992
D.1985

Answer:D

257) Which of the following is the extension of Notepad?

A. .txt
B. .xls
C. .ppt
D. .bmp

Answer: A

258) What else is a command interpreter called?

A.prompt
B.kernel
C.shell
D.command

Answer: C

259) What is the full name of FAT?

A. File attribute table


B. File allocation table
C. Font attribute table
D. Format allocation table

Answer: B

260) BIOS is used?

A. By operating system
B. By compiler
C. By interpreter
D. By application software

Answer: A

261) What is the mean of the Booting in the operating system?

A. Restarting computer
B. Install the program
C. To scan
D. To turn off

Answer:A

262) When does page fault occur?

A. The page is present in memory.


B. The deadlock occurs.
C.The page does not present in memory.
D. The buffering occurs.

Answer: C

263) Banker's algorithm is used?

A. To prevent deadlock
B. To deadlock recovery
C. To solve the deadlock
D. None of these
Answer: A

264) When you delete a file in your computer, where does it go?

A. Recycle bin
B. Hard disk
C.Taskbar
D. None of these

Answer: A

265) Which is the Linux operating system?

A. Private operating system


B. Windows operating system
C. Open-source operating system
D. None of these

Answer: C

266) What is the full name of the DSM?

A. Direct system module


B. Direct system memory
C. Demoralized system memory
D. Distributed shared memory

Answer: D

267) What is the full name of the IDL?

A. Interface definition language


B. Interface direct language
C. Interface data library
D. None of these

Answer: A

268) What is bootstrapping called?

A. Cold boot
B. Cold hot boot
C. Cold hot strap
D. Hot boot

Answer: A

269) What is the fence register used for?

A. To disk protection
B. To CPU protection
C. To memory protection
D. None of these

Answer: C

270) If the page size increases, the internal fragmentation is also?..?


A. Decreases
B. Increases
C. Remains constant
D None of these

Answer: b

271) Which of the following is a single-user operating system?

A. Windows
B. MAC
C. Ms-Dos
D. None of these

Answer:C

272) ) Choose a correct statement regarding automatic variables.

A) #include<stdio.h>
main()

{
auto int a;

printf("%d", a);
}

//output is compiler error. a is not initialized.

B) #include<stdio.h>
main()

{
auto int a;

printf("%d", a);
}

//output = 0

C) #include<stdio.h>
main()

{
auto int a;

printf("%d", a);
}

//output = null

D) #include<stdio.h>
main()

{
auto int a;

printf("%d", a);
}
//output = some random number

Answer:D

273) What is the output of the program.?

#include<stdio.h>
int main()
{
printf("Hello Boss.");
}

A) Hello Boss.
B) hello boss
C) No output
D) Compiler error

Answer:D

274) What is the output of the program.?

int main()
{
auto int a=10;
{
auto int a = 15;
printf("%d ", a);
}
printf("%d ", a);
return 1;
}

A) 10 10
B) 10 15
C) 15 10
D) Compiler error

Answer:C

275) What is the output of the program.?

int main()
{
register a=10;
{
register a = 15;
printf("%d ", a);
}
printf("%d ", a);

return 20;
}

A) 15 20
B) 15 10
C) 10 15
D) 15 15

Answer:B

276) What is the output of the C Program statement.?


register int b;
prinf("%d", b);

A) null
B) 0
C) random integer number
D) random real number

Answer:C

277) What is the output the program.?

int main()
{
register a=80;
auto int b;
b=a;
printf("%d ", a);
printf("%d ", b);

return -1;
}

A) Compiler error. You can not assign register value to int variable.
B) 80 80
C) 80 0
Register value can not be copied.
D) Compiles, but output is none.

Answer:B

278) What is the output of the program.?

void myshow();

int main()
{
myshow();
myshow();
myshow();
}

void myshow()
{
static int k = 20;
printf("%d ", k);
k++;
}

A) 20 20 20
B) 20 21 21
C) 20 21 22
D) Compiler error.

Answer: C

279) What is the output of the program.?

#include<stdio.h>
static int k;

int main()
{
printf("%d", k);

return 90;
}

A) -1
B) 0
C) 90
D) Compiler error

Answer:B

280) What is the output of the program.?

int main()
{
register k = 25;
printf("%d", &k);

return 90;
}

A) prints of address of variable k.


B) 25
C) 0
D) Compiler error

Answer:D

281) The statement below is .....a


extern int p;

A) Declaration
B) Definition
C) Initialization
D) None of the above

Answer :A

282)What is a C Storage Class.?

A) C Storage decides where to or which memory store the variable.


B) C Storage Class decides what is the default value of a variable.
C) C Storage Class decides what is the Scope and Life of a variable.
D) All the above.

Answer:D
283) Every C Variable must have.?

A) Type
B) Storage Class
C) Both Type and Storage Class
D) Either Type or Storage Class

Answer:C

284) Find a C Storage Class below.

A) static
B) auto
C) register & extern
D) All the above

Answer:D

285) What is the default C Storage Class for a variable.?

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

Answer:B

286) Choose a right answer.

A) auto variable is stored in 'Memory'.


static variable is stored in 'Memory'.
extern variable is stored in 'Memory'.
register variable is stored in 'Memory'.

B) auto variable is stored in 'Memory'.


static variable is stored in 'Memory'.
extern variable is stored in 'Memory'.
register variable is stored in 'Register'.

C) auto variable is stored in 'Register'.


static variable is stored in 'Register'.
extern variable is stored in 'Register'.
register variable is stored in 'Memory'.

D) auto variable is stored in 'Register'.


static variable is stored in 'Register'.
extern variable is stored in 'Register'.
register variable is stored in 'Register'.

Answer:B

287) A register variable is stored in a Register. Where does a Register Present in


a Computer.?

A) RAM ( Random Access Memory )


B) ROM ( Read Only Memory )
C) CPU (Central Processing Unit )
D) DMA ( Direct Memory Access )

Answer:C

288) Variables of type auto, static and extern are all stored in .?

A) ROM
B) RAM
C) CPU
D) Compiler

Answer:B

289) 11) Which among the following is a Local Variable.?

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

Answer:B

290) Which among the following is a Global Variable.?

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

Answer:D

291) Choose a correct statement about static variable.

A) A static global variable can be accessed in other files.


B) A static global variable can be used only in a file in which it is declared.
C) A static global variable can not be declared without extern keyword.
D) Default value of a static variable is -1.

Answer:B

292) register float a = 3.14f;

Choose right statement.

A) Variable a is stored in CPU registers for fast access.

B) Variable a is converted to int and then stored in a CPU register.

C) register Storage Class is ignored and treated as


auto float a = 3.14f;

D) You get a compiler error as you can not store non integer value in a CPU
register.

Answer:C
293)which of the following is not a storage class specifier?

A. auto
B. register
C. extern
D. volatile

Ans : A

294) what is the inital value of register storage class specifier?

A. 0
B. Null
C. Garbage
D. Infinite

Ans : C

295) What is the scope of extern class specifier?

A. Within block
B. Within Program
C. Global Multiple files
D. None of the above

Ans : C

296) What is the scope of static class specifier?

A. Within block
B. Within Program
C. Global Multiple files
D. None of the above
View Answer

Ans : A

297)what is the inital value of extern storage class specifier?

A. 0
B. Null
C. Garbage
D. Infinite
View Answer

Ans : A

298) What will be output for the folowing code?

A. 2 1
B. 0 0
C. 3 2
D. Compilation error

Ans : B
299) What will be output for the folowing code?

A. 5
B. 6
C. 4
D. Compilation error

Ans : C

300) Which of the following statement are correct?


(I) The maximum value a variable can hold depends upon its storage class. (II) By
default all variables enjoy a static storage class.

A. Only I is correct
B. Only II is correct
C. Both I & II are correct
D. Both I & II are incorrect

Ans : D

You might also like