Programming Online MCQs With Answers

We have compiled very important and most repeated questions for Programming Online MCQs which are asked in academic as well as in different exams. Most importantly our Online MCQs will help you to evaluate and check your knowledge of computer and IT basics. These Computer Knowledge MCQs will help you to crack any competitive or academic exams. 

Youth For Pakistan has provided an excellent opportunity for the students to prepare for their Computer Knowledge Online MCQs test. These Online Computer Knowledge MCQs cover all the topics including MS Powerpoint, MS Word, MS Excel, Information Technology, Hardware, Internet, Operating Systems, Keyboard Shortcuts, Network, Data Structure, DBMS, Security, Abbreviations, Computer Graphics, Output, Memory, Electronics, Input, Marketing, File Location, File Extensions, Software, Programming, Computer Basics, Windows, Binary, Discrete Mathematics, Data Communication, Compiler and OOPS.

The questions about computers are asked in almost every test whether it is for admission to some institutes or for recruitment purposes. 

Programming Online MCQs with Answers

We strongly recommend to all of our visitors that they attempt these Programming Online MCQs tests more than one time after completing the preparation so that they can prepare for the Programming MCQs in the best possible way.

1. Which of the following declaration is illegal?
int a = 0, b = 1, c = 2; int array[3] = {a, b, c};
int size = 3; int array[size];
int size = 3; int array[size] = {1, 2, 3};
All of the mentioned
None of these
Correct Ans: int size = 3; int array[size] = {1, 2, 3};

2. The elements in the array of the following code are <br><br>int array[5] = {5};
5, 5, 5, 5, 5
5, 0, 0, 0, 0
5, (garbage), (garbage), (garbage), (garbage)
(garbage), (garbage), (garbage), (garbage), 5
None of these
Correct Ans: 5, 0, 0, 0, 0

3. Different ways to initialize an array with all elements as zero are
int array[5] = {};
int array[5] = {0};
int a = 0, b = 0, c = 0; int array[5] = {a, b, c};
All of the mentioned
None of these
Correct Ans: All of the mentioned

4. Which of the following are correct syntaxes to send an array as a parameter to function:
func(&array);
func(array);
func(array[size]);
Both a and b
None of these
Correct Ans: Both a and b

5. Which of the following does not initialize ptr to null (assuming variable declaration of &quot;a&quot; as int a=0;?
int *ptr = &amp;a;
int *ptr = &amp;a &ndash; &amp;a;
int *ptr = a &ndash; a;
All of the mentioned
None of these
Correct Ans: int *ptr = &amp;a;

6. Comment on the following? <br><br>const int *ptr;
You cannot change the value pointed by ptr
You cannot change the pointer ptr itself
Both (a) and (b)
You can change the pointer as well as the value pointed by it
None of these
Correct Ans: You cannot change the value pointed by ptr

7. Comment on the following pointer declaration?
int *ptr, p;
ptr is a pointer to integer, p is not
ptr and p, both are pointers to integer
ptr is a pointer to integer, p may or may not be
ptr and p both are not pointers to integer
None of these
Correct Ans: ptr is a pointer to integer, p is not

8. The #else directive is used for
Conditionally include source text if the previous #if, #ifdef, #ifndef, or #elif test fails
Conditionally include source text if a macro name is not defined
Conditionally include source text if a macro name is defined
Ending conditional text
None of these
Correct Ans: Conditionally include source text if the previous #if, #ifdef, #ifndef, or #elif test fails

9. For each #if, #ifdef, and #ifndef directive.
There are zero or more #elif directives
Zero or one #else directive
One matching #endif directive
All of the mentioned
None of these
Correct Ans: All of the mentioned

10. Which of the following sequences are unaccepted in C language?
#if #else #endif
#if #elif #endif
#if #if #endif
#if #undef #endif
None of these
Correct Ans: #if #if #endif

11. How is search done in #include and #include &ldquo;somelibrary.h&rdquo; according to C standard?
When former is used, current directory is searched and when latter is used, standard directory is searched
When former is used, standard directory is searched and when latter is used, current directory is searched
When former is used, search is done in implementation defined manner and when latter is used, current directory is searched
For both, search for &lsquo;somelibrary&rsquo; is done in implementation-defined places
None of these
Correct Ans: For both, search for &lsquo;somelibrary&rsquo; is done in implementation-defined places

12. Which directory the compiler first looks for the file when using #include ?
Current directory where program is saved
C:COMPILERINCLUDE
S:SOURCEHEADERS
Both (b) and (c) simultaneously
None of these
Correct Ans: C:COMPILERINCLUDE

13. #pragma exit is primarily used for?
Checking memory leaks after exiting the program
Informing Operating System that program has terminated
Running a function at exiting the program
No such preprocessor exist
None of these
Correct Ans: Running a function at exiting the program

14. #include <somefile.h> are _______ files and #include “somefile.h” ________ files.
Library, Library
Library, user-created header
User-created header, library
They can include all types of file
None of these
Correct Ans: They can include all types of file

15. Preprocessor feature that supply line numbers and filenames to compiler is called?
Selective inclusion
macro substitution
Concatenation
Line control
None of these
Correct Ans: Line control

16. Property which allows to produce different executable for different platforms in C is called?
File inclusion
Selective inclusion
Conditional compilation
Recursive macros
None of these
Correct Ans: Conditional compilation

17. Property of external variable to be accessed by any source file is called by C90 standard as
external linkage
external scope
global scope
global linkage
None of these
Correct Ans: external linkage

18. What is the problem in the following declarations? <br>int func(int); <br>double func(int); <br>int func(float);
A function with same name cannot have different signatures
A function with same name cannot have different return types
A function with same name cannot have different number of parameters
All of the mentioned
None of these
Correct Ans: All of the mentioned

19. Which function in the following expression will be called first?<br><br>a = func3(6) – func2(4, 5) / func1(1, 2, 3);
func1();
func2();
func3();
Cannot be predicted.
None of these
Correct Ans: Cannot be predicted.

20. Which of the following is the correct order of evaluation for the given expression? <br><br>a = w % x / y * z;
% / * =
/ * % =
= % * /
* % / =
None of these
Correct Ans: % / * =

21. In expression i = g() + f(), first function called depends on
Compiler
Associativity of () operator
Precedence of () and + operator
Left to right of the expression
None of these
Correct Ans: Compiler

22. Operation “a = a * b + a” can also be written as:
a *= b + 1;
(c = a * b)!=(a = c + a);
a = (b + 1)* a;
All of the mentioned
None of these
Correct Ans: All of the mentioned

23. What is the value of the below assignment expression <br>(x = foo())!= 1 considering foo() returns 2
2
TRUE
1
0
None of these
Correct Ans: 2

24. When do you need to use type-conversions?
The value to be stored is beyond the max limit
The value to be stored is in a form not supported by that data type
To reduce the memory in use, relevant to the value
All of the mentioned
None of these
Correct Ans: All of the mentioned

25. Which of the following type-casting have chances for wrap around?
From int to float
From int to char
From char to short
From char to int
None of these
Correct Ans: From int to char

26. What will be the data type of the result of the following operation? <br>(float)a * (int)b / (long)c * (double)d
int
long
float
double
None of these
Correct Ans: double

27. function tolower(c) defined in library works for
Ascii character set
Unicode character set
Ascii and utf-8 but not EBSIDIC character set
Any character set
None of these
Correct Ans: Any character set

28. Which among the following are the fundamental arithmetic operators, ie, performing the desired operation can be done using that operator only?
+, &ndash;
+, -, %
+, -, *, /
+, -, *, /, %
None of these
Correct Ans: +, &ndash;

29. C99 standard guarantees uniqueness of _____ characters for external names.
32
64
13
15
None of these
Correct Ans: 32

30. C99 standard guarantees uniqueness of ____ characters for internal names.
31
63
12
14
None of these
Correct Ans: 63

31. To declare a 3 dimension array using pointers, which of the following is the correct syntax:
char *a[][];
char **a[];
char ***a;
All of the mentioned
None of these
Correct Ans: char *a[][];

32. Applications of multidimensional array are?
Matrix-Multiplication
Minimum Spanning Tree
Finding connectivity between nodes
All of the mentioned
None of these
Correct Ans: All of the mentioned

33. Which of the following is not possible statically in C?
Jagged Array
Rectangular Array
Cuboidal Array
Multidimensional Array
None of these
Correct Ans: Jagged Array

34. How many number of pointer (*) does C have against a pointer variable declaration?
7
127
255
No limits
None of these
Correct Ans: No limits

35. Calling a function f with a an array variable a[3] where a is an array, is equivalent to
f(a[3])
f(*(a + 3))
f(3[a])
All of the mentioned
None of these
Correct Ans: All of the mentioned

36. The syntax for constant pointer to address (i.e., fixed pointer address) is:
const <type> * <name>
<type> * const <name>
<type> const * <name>
Both (a) and (c)
None of these
Correct Ans: <type> * const <name>

37. Comment on an array of void data type:
It can store any data-type
It only stores element of similar data type to first element
It acquires the data type with the highest precision in it
You cannot have an array of void data type
None of these
Correct Ans: You cannot have an array of void data type

38. An array of similar data types which themselves are collection of dissimilar data type are
Linked Lists
Trees
Array of Structure
All of the mentioned
None of these
Correct Ans: Array of Structure

39. The maximum number of arguments that can be passed in a single function are _________
127
253
361
No limits in number of arguments
None of these
Correct Ans: 253

40. Arguments that take input by user before running a program are called?
main function arguments
main arguments
Command-Line arguments
Parameterized arguments
None of these
Correct Ans: Command-Line arguments

41. Which type of variables can have same name in different function:
global variables
static variables
Function arguments
Both (b) and (c)
None of these
Correct Ans: Both (b) and (c)

42. Which of the following can never be sent by call-by-value?
Variable
Array
Structures
Both (b) and (c)
None of these
Correct Ans: Array

43. Which is an indirection operator among the following?
&
*
->
Dot (.)
None of these
Correct Ans: *

44. Conditional inclusion can be used for
Preventing multiple declarations of a variable
Check for existence of a variable and doing something if it exists
Preventing multiple declarations of same function
All of the mentioned
None of these
Correct Ans: All of the mentioned

45. The “else if” in conditional inclusion is written by?
#else if
#elseif
#elsif
#elif
None of these
Correct Ans: #elif

46. Which of the following properties of #define not true?
You can use a pointer to #define
#define can be made externally available
They obey scope rules
All of the mentioned
None of these
Correct Ans: All of the mentioned

47. What is the advantage of #define over const?
Data type is flexible
Can have a pointer
Reduction in the size of the program
Both (a) and (c)
None of these
Correct Ans: Data type is flexible

48. Which of the following file extensions are accepted with #include?
.h
.in
.com
All of the mentioned
None of these
Correct Ans: All of the mentioned

49. What would happen if you create a file stdio.h and use #include “stdio.h” ?
The predefined library file will be selected
The user-defined library file will be selected
Both the files will be included
The compiler won’t accept the program
None of these
Correct Ans: The user-defined library file will be selected

50. What is the sequence for preprocessor to look for the file within <> ?
The predefined location then the current directory
The current directory then the predefined location
The predefined location only
The current directory location
None of these
Correct Ans: The predefined location then the current directory

51. The preprocessor provides the ability for _______________.
The inclusion of header files
The inclusion of macro expansions
Conditional compilation and line control
All of the mentioned
None of these
Correct Ans: All of the mentioned

52. Which of the following are C preprocessors?
#ifdef
#define
#endif
All of the mentioned
None of these
Correct Ans: All of the mentioned

53. A preprocessor is a program
That processes its input data to produce output that is used as input to another program
That is nothing but a loader
That links various source files
All of the mentioned
None of these
Correct Ans: That processes its input data to produce output that is used as input to another program

54. The variable declaration with no storage class specified is by default:
auto
extern
static
register
None of these
Correct Ans: auto

55. Which of the following storage class supports char data type?
register
static
auto
All of the mentioned
None of these
Correct Ans: All of the mentioned

56. Automatic variables are variables that are
Declared within the scope of a block, usually a function
Declared outside all functions
Declared with auto keyword
Declared within the keyword extern
None of these
Correct Ans: Declared within the scope of a block, usually a function

57. Automatic variables are stored in
stack
data segment
register
heap
None of these
Correct Ans: stack

58. Which of the following is a storage specifier?
enum
union
auto
volatile
None of these
Correct Ans: auto

59. Automatic variables are allocated space in the form of a:
stack
queue
priority queue
random
None of these
Correct Ans: stack

60. The scope of an automatic variable is:
Within the block it appears
Within the blocks of the block it appears
Until the end of program
Both (a) and (b)
None of these
Correct Ans: Both (a) and (b)

61. Register variables reside in
stack
registers
heap
main memory
None of these
Correct Ans: registers

62. Which among the following is the correct syntax to declare a static variable register?
static register a;
register static a;
Both (a) and (b)
We cannot use static and register together.
None of these
Correct Ans: We cannot use static and register together.

63. Which of the following operation is not possible in a register variable?
Reading the value into a register variable
Copy the value from a memory variable
Global declaration of register variable
All of the mentioned
None of these
Correct Ans: All of the mentioned

64. Which data type can be stored in register?
int
long
float
All of the mentioned
None of these
Correct Ans: All of the mentioned

65. Which of the following is true for static variable?
It can be called from another function.
It exists even after the function ends.
It can be modified in another function by sending it as a parameter.
All of the mentioned
None of these
Correct Ans: It exists even after the function ends.

66. What is the format identifier for “static a = 20.5;”?
%s
%d
%f
Illegal declaration due to absence of data type
None of these
Correct Ans: %d

67. Which of following is not accepted in C?
static a = 10; //static as
static int func (int); //parameter as static
static static int a; //a static variable prefixed with static
All of the mentioned
None of these
Correct Ans: static static int a; //a static variable prefixed with static

68. Array sizes are optional during array declaration by using ______ keyword.
auto
static
extern
register
None of these
Correct Ans: extern

69. What is the scope of a function?
Whole source file in which it is defined
From the point of declaration to the end of the file in which it is defined
Any source file in a program
From the point of declaration to the end of the file being compiled
None of these
Correct Ans: From the point of declaration to the end of the file being compiled

70. What is the scope of an external variable?
Whole source file in which it is defined
From the point of declaration to the end of the file in which it is defined
Any source file in a program
From the point of declaration to the end of the file being compiled
None of these
Correct Ans: From the point of declaration to the end of the file being compiled

71. Functions in C are ALWAYS:
Internal
External
Both Internal and External
External and Internal are not valid terms for functions
None of these
Correct Ans: External

72. What is the return-type of the function sqrt()
int
float
double
Depends on the data type of the parameter
None of these
Correct Ans: double

73. The value obtained in the function is given back to main by using ________ keyword?
return
static
new
volatile
None of these
Correct Ans: return

74. Which function definition will run correctly?
int sum(int a, int b)
return (a + b);
int sum(int a, int b)
{return (a + b);}
int sum(a, b)
return (a + b);
Both (a) and (b)
None of these
Correct Ans: int sum(int a, int b)
{return (a + b);}

75. Which of the following function declaration is illegal?
int 1bhk(int);
int 1bhk(int a);
int 2bhk(int*, int []);
All of the mentioned
None of these
Correct Ans: All of the mentioned

76. Which of the following is a correct format for declaration of function?
return-type function-name(argument type);
return-type function-name(argument type)
{}
return-type (argument type)function-name;
Both (a) and (b)
None of these
Correct Ans: return-type function-name(argument type);

77. Which keyword is used to come out of a loop only for that iteration?
break
continue
return
All of the mentioned
None of these
Correct Ans: continue

78. The keyword ‘break’ cannot be simply used within:
do-while
if-else
for
while
None of these
Correct Ans: if-else

79. Which keyword can be used for coming out of recursion?
break
return
exit
Both (a) and (b)
None of these
Correct Ans: return

80. Which loop is most suitable to first perform the operation and then test the condition?
for loop
while loop
do-while loop
All of the mentioned
None of these
Correct Ans: do-while loop

81. Example of iteration in C.
for
while
do-while
All of the mentioned
None of these
Correct Ans: All of the mentioned

82. Which of the following cannot be used as LHS of the expression in for (exp1;exp2; exp3) ?
Variable
Function
typedef
macros
None of these
Correct Ans: macros

83. The following code ‘for(;;)’ represents an infinite loop. It can be terminated by ______
break
exit(0)
abort()
All of the mentioned
None of these
Correct Ans: break

84. Which of the following is possible with any 2 operators in C?
Same associativity, different precedence
Same associativity, same precedence
Different associativity, different precedence
All of the mentioned
None of these
Correct Ans: All of the mentioned

85. Which of the following is NOT possible with any 2 operators in C?
Different precedence, same associativity
Different precedence, different associativity
Same precedence, different associativity.
All of the mentioned
None of these
Correct Ans: Same precedence, different associativity.

86. What is the type of the below assignment expression if x is of type float, y is of type int? <br><br>y = x + y;
int
float
There is no type for an assignment expression
double
None of these
Correct Ans: int

87. Which type conversion is NOT accepted?
From char to int
From float to char pointer
From negative int to char
From double to char
None of these
Correct Ans: From float to char pointer

88. When double is converted to float, the value is?
Truncated
Rounded
Depends on the compiler
Depends on the standard
None of these
Correct Ans: Depends on the compiler

89. Relational operators cannot be used on:
structure
long
strings
float
None of these
Correct Ans: structure

90. Which among the following is NOT a logical or relational operator?
!=
==
||
=
None of these
Correct Ans: =

91. Which of the following data type will throw an error on modulus operation(%)?
char
short
int
float
None of these
Correct Ans: float

92. Which of the following is not an arithmetic operation?
a *= 10;
a /= 10;
a != 10;
a %= 10;
None of these
Correct Ans: a != 10;

93. The precedence of arithmetic operators is (from highest to lowest)
%, *, /, +, &ndash;
%, +, /, *, &ndash;
+, -, %, *, /
%, +, -, *, /
None of these
Correct Ans: %, *, /, +, &ndash;

94. Which is false ?
A variable defined once can be defined again with different scope
A single variable cannot be defined with two different types in the same scope
A variable must be declared and defined at the same time
A variable refers to a location in memory
None of these
Correct Ans: A variable must be declared and defined at the same time

95. Which of the following is not a pointer declaration?
char a[10];
char a[] = {&lsquo;1&rsquo;, &lsquo;2&rsquo;, &lsquo;3&rsquo;, &lsquo;4&rsquo;};
char *str;
char a;
None of these
Correct Ans: char a;

96. Which keyword is used to prevent any changes in the variable within a C program?
immutable
mutable
const
volatile
None of these
Correct Ans: const

97. Which is false?
Constant variables need not be defined as they are declared and can be defined later
Global constant variables are initialised to zero
const keyword is used to define constant values
You cannot reassign a value to a constant variable
None of these
Correct Ans: Constant variables need not be defined as they are declared and can be defined later

98. enum types are processed by
Compiler
Preprocessor
Linker
Assembler
None of these
Correct Ans: Compiler

99. What is short int in C programming?
Basic datatype of C
Qualifier
short is the qualifier and int is the basic datatype
All of the mentioned
None of these
Correct Ans: short is the qualifier and int is the basic datatype

100. What is the size of an int data type?
4 Bytes
8 Bytes
Depends on the system/compiler
Cannot be determined
None of these
Correct Ans: Depends on the system/compiler

101. Which of the following is a User-defined data type?
typedef int Boolean;
typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;
struct {char name[10], int age};
all of the mentioned
None of these
Correct Ans: all of the mentioned

102. Which data type is most suitable for storing a number 65000 in a 32-bit system?
signed short
Unsigned short
long
int
None of these
Correct Ans: Unsigned short

103. The format identifier &lsquo;%i&rsquo; is also used for _____ data type
char
int
float
double
None of these
Correct Ans: int

104. Which of the following cannot be a variable name in C?
volatile
TRUE
friend
export
None of these
Correct Ans: volatile

105. Which of the following is not a valid variable name declaration?
float PI = 3.14;
double PI = 3.14;
int PI = 3.14;
#define PI 3.14
None of these
Correct Ans: #define PI 3.14

106. Which is valid C expression?
int my_num = 100,000;
int my_num = 100000;
int my num = 1000;
int $my_num = 10000;
None of these
Correct Ans: int my_num = 100000;

107. Which of the following is true for variable names in C?
They can contain alphanumeric characters as well as special characters
It is not an error to declare a variable to be one of the keywords(like goto, static)
Variable names cannot start with a digit
Variable can be of any length
None of these
Correct Ans: Variable names cannot start with a digit

108. Which of the following is not a valid C variable name?
int number;
float rate;
int variable_count;
int $main;
None of these
Correct Ans: int $main;

109. Variable names beginning with underscore is not encouraged. Why?
It is not standardized
To avoid conflicts since assemblers and loaders use such names
To avoid conflicts since library routines use such names
To avoid conflicts with environment variables of an operating system
None of these
Correct Ans: To avoid conflicts since library routines use such names

110. Which of the following is not a valid variable name declaration?
int _a3;
int a_3;
int 3_a;
int _3a
None of these
Correct Ans: int 3_a;

111. Which bitwise operator is suitable for turning off a particular bit in a number?
&amp;&amp; operator
&amp; operator
|| operator
! operator
None of the above
Correct Ans: &amp; operator

112. What will happen if the following loop is executed ? <br><br>int num = 0; <br>do <br>{ <br>–num; <br>printf(???%d???, num); <br>num++; <br>}while (num >= 0); <br>}
The loop will run infinite number of times
The program will not enter the loop
There will be a compilation error
There will be runtime error
None of these
Correct Ans: There will be a compilation error

113. The library function sqrt( ) operates on a double precision argument. If, i is an integer variable, which one of the following calls would correctly compute sqrt(i) ?
sqrt((double)i)
(double) sqrt(i)
(double) (sqrt(i))
sqrt(i)
None of these
Correct Ans: sqrt((double)i)

114. If an integer occupies 4 bytes and a character occupies 1 bytes of memory, each element of the following structure would occupy how many bytes ?<br>struct name<br>{<br>int age;<br>char name [20];<br>}
5
24
21
22
None of these
Correct Ans: 24

115. The function fprintf is used in a program_____
When too many printf calls have been already used in the program
In place of printf, since printf uses more memory
When the output is to be printed on to a file
When the type of variables to be printed are not known before
None of these
Correct Ans: When the output is to be printed on to a file

116. If an array is used as function argument, the array is passed ______
by value
by reference
by name
the array cannot be used as a function argument
None of these
Correct Ans: by reference

117. __________ is a named location in memory that is used to hold the value that may be modified by the program.
Expression
Keyword
Variable
Identifiers
None of these
Correct Ans: Variable

118. The general form, of assignment operator is _________
variable_name=expression.
datatype=expression.
variable=expression.
datatype=expression1.
None of these
Correct Ans: variable_name=expression.

119. The name of the variables, functions, labels and other user defined object are called _______
expression
identifier
pointer
statement
None of these
Correct Ans: identifier

120. Which of the following shows the correct hierarchy of arithmetic operators in C ?
**, * or /, + or –
**, *, /, +, –
**, /, *, +, –
/ or *, – or +
None of these
Correct Ans: / or *, – or +

121. The maximum value that an integer constant can have is ______
-32767
32767
1.70E+38
-1.70E+38
None of these
Correct Ans: 32767

122. The language processor which converts assembly language into machine language is
Interpreter
Compiler
Assembler
Transmitter
None of these
Correct Ans: Assembler

123. Which of the following commands is used to monitor disk input and output on a UNIX system ?
sar
iostat
nfsstat
vmstat
None of these
Correct Ans: iostat

124. Informal high level description of an algorithm in english is called
Function
Class
Pseudo Code
Structure
None of these
Correct Ans: Pseudo Code

125. ____________ punctuation ends most lines of C++ code.
Single quotes
; (semi-colon)
. (dot)
: (colon)
” (double quote)
Correct Ans: ; (semi-colon)

126. Diagrammatic representation or symbolic representation of an algorithm is
Data Flow Diagram
E-R Diagram
FlowChart
Pro chart
None of the Above
Correct Ans: FlowChart

127. What are the types of linkages?
Internal and External
External, Internal and None
External and None
Internal
None of the Above
Correct Ans: External and None

128. In C, if you pass an array as an argument to a function, what actually gets passed?
Value of elements in array
First element of the array
Base address of the array
Address of the last element of array
None of these
Correct Ans: Base address of the array

129. ____________ punctuation ends most lines of C code.
Single quotes
; (semi-colon)
. (dot)
: (colon)
” (double quote)
Correct Ans: ; (semi-colon)

130. The first network to implement TCP/IP are
APRANET
INTERNET
MANET
MODEM
None of these
Correct Ans: APRANET

131. Which of the following is a programming language for creating special programs like applets ?
JAVA
Cable
Net
Domain name
None of these
Correct Ans: JAVA

132. If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
.
&
*
->
None of these
Correct Ans: ->

133. ______ is an OOP principle.
Structured programming
Procedural programming
Inheritance
Linking
None
Correct Ans: Inheritance

134. In which header file is the NULL macro defined ?
stdio.h
stddef.h
stdio.h and stddef.h
math.h
None of these
Correct Ans: stdio.h and stddef.h

135. How will you print \n on the screen?
printf(“\n”);
echo “\\n”;
printf(‘\n’);
printf(“\\n”);
None of the above
Correct Ans: echo “\\n”;

136. Which of the following function sets first n characters of a string to a given character?
strinit()
strnset()
strset()
strcset()
None of these
Correct Ans: strnset()

137. Symbolic constants can be defined using ___&nbsp;
extern
const
define
All of the above
None of these
Correct Ans: const

138. What are the types of linkages?
Internal and External
External, Internal and None
External and None
Internal
None of the Above
Correct Ans: External, Internal and None

139. In C, if you pass an array as an argument to a function, what actually gets passed?
Value of elements in array
First element of the array
Base address of the array
Address of the last element of array
None of these
Correct Ans: Base address of the array

140. ____________ punctuation ends most lines of C code.
&#39; (single quote)
; (semi-colon)
. (dot)
: (colon)
” (double quote)
Correct Ans: ; (semi-colon)

Leave a Comment