int i = 2.5; do { cout i * 2; } while (i > 3 && i < 10);
(a) 510
(b) 5
(c) 48
(d) error
2.What does !(7) evaluate to in decimal where ! is a NOT operator?
(a) 7
(b) 8
(c) 9
(d) 10
3.The condition in while loop may contain logical expression but not relational expression.
(a) True
(b) False
4.Searching is easier when an array is already sorted .
(a) True
(b) False
5.If an array has 100 elements, what is allowable range of subscripts?
(a) 0 - 99
(b) 1 - 99
(c) 0 - 100
(d) 1 - 100
6.What will be the value of ‘a’ and ‘b’ after executing the following statements?
a = 3; b = a++;
(a) 3, 4
(b) 4, 4
(c) 3, 3
(d) 4, 3
7.What will be the correct syntax to initialize all elements of two-dimensional array to value 0?
(a) int arr[2][3] = {0,0} ;
(b) int arr[2][3] = {{0},{0}} ;
(c) int arr[2][3] = {0},{0} ;
(d) int arr[2][3] = {0} ;
8.Which of the following function returns the size of a string variable?
(a) strlength()
(b) stringlen()
(c) strlen()
(d) strLength()
9.What will be the range of numbers generated by function rand () % 9?
(a) 0 to 9
(b) 1 to 9
(c) 0 to 8
(d) 1 to 8
10.Computer can understand only machine language code.
(c) True
(d) False
11.What does 5 ^ 6 , evaluate to in decimal where ‘^’ is Exclusive OR operator?
(a) True
(b) False
Detail:- It mean
5 = 0101
6 = 0110
5 ^ 6 = 0011
If both input is same then the output is 0 and if different then output is 1
12.If the file is not properly closed in the program, the program ____________.
(a) Terminate normally
(b) Indicate Runtime error
(c) Indicate Compile time error
(d) Crashes
13.Which of the following header file include string conversion functions?
(a) string.h
(b) stdlib.h
(c) ctype.h
(d) sconvert.h
14.The function of cin is
(a) To display message
(b) To read data from keyboard
(c) To display output on the screen
(d) To send data to printer
15.In C/C++ language the header file which is used to perform useful task and manipulation of character data is
(a) cplext.h
(b) ctype.h
(c) stdio.h
(d) delay.h
16.How many parameter(s) function getline() takes?
(a) 0
(b) 1
(c) 2
(d) 3
18.Word processor is
(a) Operating system
(b) Application software
(c) Device driver
(d) Utility software
19.What will be the correct syntax to initialize all elements of two-dimensional array to value 0?
(a) int arr[2][3] = {0,0} ;
(b) int arr[2][3] = {{0},{0}} ;
(c) int arr[2][3] = {0},{0} ;
(d) int arr[2][3] = {0} ;
20.How many bytes will the pointer intPtr of type int move in the following statement? intPtr += 3 ;
(a) 3 bytes
(b) 6 bytes
(c) 12 bytes
(d) 24 bytes
21.If there are 2(n+1) elements in an array then what would be the number of iterations required to search a number using binary search algorithm?
(a) n elements
(b) n+1) elements
(c) 2(n+1) elements
(d) 2 (n+1) elements
23.Which of the following operator is used to access the value of variable pointed to by a pointer?
(a) * operator
(b) -> operator
(c) && operator
(d) & operator
24.The ________ statement interrupts the flow of control.
(a) switch
(b) continue
(c) goto
(d) break
25.Analysis is the -------------- step in designing a program
(a) Last
(b) Middle
(c) Post Design
(d) First
26.Paying attention to detail in designing a program is _________
(a) Time consuming
(b) Redundant
(c) Necessary
(d) Somewhat Good
27.statement in curly braces is,
(a) Not required
(b) Good programming
(c) Relevant
(d) Must
28.The while loop becomes infinite,
(a) When the condition is always false
(b) . When the condition is less than zero
(c) When the condition is always true
(d) When the condition contains a logical operator
29.Which of the following function(s) is/are included in stdlib.h header file?
(a) double atof(const char *nptr)
(b) int atoi(const char *nptr)
(c) char *strcpy ( char *s1, const char *s2)
(d) 1 and 2 only
30.If we want to store a string “abc” in an array str then the size of this array must be at least,
(a) 2
(b) 3
(c) 4
(d) 5
31.No executable code will be generated if error is found during translation of the program using interpreter.
(a) True
(b) False
32.a single command using cout?
(a) cout << "Hello" + x + "\n";
(b) cout << "H" << x << "\n";
(c) cout << "H", x, "\n";
(d) cout << ("H" & x & "\n");
33.Which of the following is correct way to initialize a variable x of int type with value 10?
(a) int x ; x = 10 ;
(b) int x = 10 ;
(c) int x, x = 10;
(d) x = 10 ;
34.If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
(a) parentheses ( )
(b) braces { }
(c) brackets [ ]
(d) arrows < >
35.Name of an array is a constant pointer.
(a) True
(b) False
36.How many bytes will the pointer intPtr of type int move in the following statement? intPtr += 3 ;
(a) 3 bytes
(b) 6 bytes
(c) 12 bytes
(d) 24 bytes
37.What will be the value of ‘a’ and ‘b’ after executing the following statements?
a = 3;
b = a++;
(a) 3, 4
(b) 4, 4
(c) 3, 3
(d) 4, 3
38.Loader loads the executable code from hard disk to main memory
(a) True
(b) False
39.Which of the following is used with bit manipulation?
(a) Signed integer
(b) Un-signed integer
(c) Signed double
(d) Un-signed double
40.Which of the follwoing values C++ use to represent true and false?
(a) 1 and 0
(b) 1 and -1
(c) 11 and 00
(d) Any numerical value
41.The argument of the is digit() function is ___________________
(a) a character,
(b) a C-string,
(c) a C++ string class variable
(d) None of the given options.
42.A precise sequence of steps to solve a problem is called
Statement
Program
Utility
Routine
43.The Compiler of C language is written in
Java Language
UNIX
FORTRON Language
C Language
44.Initialization of variable at the time of definition is,
Must
Necessary
Good Programming
None of the given options
45.In if structure the block of statements is executed only,
When the condition is false
When it contain arithmetic operators
When it contain logical operators
When the condition is true
46.Which of the following function(s) is/are included in stdlib.h header file?
double atof(const char *nptr)
int atoi(const char *nptr)
char *strcpy ( char *s1, const char *s2)
1 and 2 only
47.Dealing with structures and functions passing by reference is the most economical method
True
False
48.Pointer is a variable which store,
Data
Memory Address
Data Type
Values
49.Preprocessor program perform its function before ______ phase takes place.
Editing
Linking
Compiling
Loading
50.Which of the following can not be a variable name?
area
_area
10area
area2
51.Which looping process is best, when the number of iterations is known?
for
while
do-while
all looping processes require that the iterations be known
52.Which character is inserted at the end of string to indicate the end of string?
new line
tab
null
carriage return
53.How many bytes are occupied by declaring following array of characters?
char str[] = “programming”;
10
11
12
13
54.Which of the following header file defines the rand() function?
iostream.h
conio.h
stdlib.h
stdio.h
55.Commenting the code _____________________
Makes a program easy to understand for others.
Make programs heavy, i.e. more space is needed for executable.
Makes it difficult to compile
All of the given options.
56.What's wrong with this for loop? for (int k = 2, k <=12, k++)
the increment should always be ++k
the variable must always be the letter i when using a for loop
there should be a semicolon at the end of the statement
the commas should be semicolons
57.For which array, the size of the array should be one more than the number of elements in an array?
int
double
float
char
58.The data type before a function name represents its,
(a) Return Type
(b) Function data
(c) Function arguments
(d) Function name
59.The header file which is used for input and output is
(a) maths.h
(b) string.h
(c) iostream.h
(d) ctype.h
60.When we are using command line argument(s), the default argument in C/C++ is/are ____________ .
a) argc
b) argd
c) argv
d) argc and argv
61.In C++, Integer calculation occurs in _____ bytes.
a) 1 byte
b) 2 bytes
c) 4 bytes
d) 8 bytes
62.In the declaration of two dimensional array,
(a) First index represents row and second represents column
(b) First index represents column and second represents row
(c) Both indexes represent rows
(d) Both indexes represent column
63.The address operator (&) can be used with,
a) Statement
b) Expression
c) Variable
d) Constant
64.______ translates high level language program into machine language code
(a) Debugger'
(b) Editor
(c) Compiler
(d) Linker
65.Which of the following data type(s) can operate on modulus operator ‘%’?
a) float, int
b) float, double
c) int
d) char
66.What will be the result of the expression z = x % y, if x = 19 and y = 4?
a) 3
b) 4
c) 15
d) 19
67.Which character is inserted at the end of string to indicate the end of string?
a) new line
b) tab
c) null
d) carriage return
68.Syntax of union is identical to ______
a) Structure
b) Class
c) Function
d) None of the given options
69.What will be the value of variable "size", if int occupies 4 bytes and double occupies 8 bytes?
a) 2
b) 4
c) 8
d) 12
70.What is function of cout ?
(a) To send data to printer
(b) To read data from keyboard
(c) To display message
(d) To display output on the screen
71.In Flow chart process is represented by
(a) Rectangle
(b) Arrow symbol
(c) Oval
(d) Circle
72.&& is -------------------- operator.
(a) An arithmetic
(b) Logical
(c) Relational
(d) Unary
73.An over Flow condition occurs when we try to assign a value to a variable which is,
(a) Less than its maximum size
(b) Greater than its maximum size
(c) With in its range
(d) Equal to its size
74.For dereferencing an array element using pointer, we use the operator
(a) &
(b) *
(c) /
(d) +
75.In the declaration of two dimensional array,
(a) First index represents row and second represents column
(b) First index represents column and second represents row
(c) Both indexes represent rows
(d) Both indexes represent column
76.Which of the following data type(s) can operate on modulus operator ‘%’?
(a) float, int
(b) float, double
(c) int
(d) char
77.Which of the following is the correct way to declare a variable x of integer type?
(a) x int ;
(b) integer x ;
(c) int x;
(d) x integer
78.Which of the following can not be a variable name?
(a) area
(b) _area
(c) 10area
(d) area2
79.Which of the function call is call by value for the following function prototype? float area (int);
(a) area(&num) ;
(b) area(num) ;
(c) area(int num) ;
(d) area(*num) ;
80.Recursive functions are used when there is a repetitive pattern.
(a) True
(b) False
81.What will be the range of numbers generated by function rand () % 9?
(a) 0 to 9
(b) 1 to 9
(c) 0 to 8
(d) 1 to 8
82.What will be the correct syntax to declare two-dimensional array of float data type?
(a) float arr{2}{2} ;
(b) float arr[2][2] ;
(c) float arr[2,2] ;
(d) float[2][2] arr ;
83.When a function finishes its execution then,
(a) The control return to its Prototype
(b) The control returns to its definition
(c) Control returns to statement following function call
(d) The compiler stop execution of whole program
84.Consider the following statements to initialize a two-dimensional array.
i. int arr[2][3] = {4, 8, 9, 2, 1, 6} ;
ii. int arr[3][2] = {4, 8, 9, 2, 1, 6} ;
iii. int arr[][2] = {{4,8},{9, 2},{1, 6}} ;
85.Editors are used to compile the code.
(a) True
(b) False
86.What is function of cout ?
(a) To send data to printer
(b) To read data from keyboard
(c) To display message
(d) To display output on the screen
87.< , <= , > , >= are called --------------------------- operators.
(a) Logical
(b) Arithmetic
(c) Relational
(d) Conational
88.In while loop the loop counter must be initialized,
(a) With in the loop
(b) Before entering the loop
(c) At the end of the loop
(d) None of the given options
89.Data Size of the file is always _________ the actual size of the file.
(a) Greater than
(b) Equal to
(c) Less than or equal to
(d) None of the above
90.The precedence of * is higher than dot operator (.)operator
(a) True
(b) False
91.Let ptr1 and ptr2 are pointer variables that points to integer data type then which one of the following arithmetic is allowed,
(a) ptr1 + ptr2
(b) ptr1 - ptr2
(c) ptr1 * ptr2
(d) ptr1 / ptr2
92.What will be the range of numbers generated by function rand () % 9?
(a) 0 to 9
(b) 1 to 9
(c) 0 to 8
(d) 1 to 8
93.What will be the correct syntax to assign an array named arr of 5 elements to a pointer ptr?
(a) *ptr = arr ;
(b) ptr = arr ;
(c) *ptr = arr[5] ;
(d) ptr = arr[5] ;
94.What will be the output of the following code segment? char *x = ”programming” ; cout << *(x+2) << *(x+3) << *(x+5) << *(x+8) ;
(a) prgm
(b) rorm
(c) ogai (
d) ramg
95.There is a pointer variable named ptr of type int then address of which type of variable the ptr will store in it?
(a) variable of type char
(b) variable of type short
(c) variable of type int
(d) variable of type double
96.Flow charts explain the working of a program in pictorial format.
(a) True
(b) False
97.The object _______________may be used both for file input and file output
(a) fstream,
(b) ifstream,
(c) ofstream,
(d) none of the given options.
98.Most efficient method of dealing with structure variables is to define the structure globally
(a) True
(b) False
99.If a variable is passed by value to a function and the function makes some changes to that variable then it
(a) does not affect the original variable
(b) affects the original variable
(c) causes syntax error
(d) None of the given options
100.The header file which is used for input and output is
(a) maths.h
(b) string.h
(c)iostream.h
(d) ctype.h
101. Suppose int multi[5][10]; when we are using **multi , it means,
(a) Single dereferencing
(b) Single referencing
(c) Double referencing
(d) Double dereferencing
102.To access the data members of structure _______ is used.
(a) dot operator (.)
(b) * operator
(c) operator
(d) None of given.
103.Which of the following is the starting index of an array in C++?
(a) 0
(b) 1
(c) -1
(d) any number
104.When a call to function statement is encountered,
(a) The control transfers to its Prototype
(b) The control transfers to its definition
(c) Control returns to statement following function call
(d) The compiler stops execution of whole program
105.A function must always return value.
(a) True
(b) False
106.If an array has 100 elements, what is allowable range of subscripts?
(a) 0 – 99
(b) 1 – 99
(c) 0 – 100
(d) 1 – 100
107.If a pointer appears on left hand side of an assignment operator then right side of that assignment operator must be,
(a) Variable name
(b) Address of variable
(c) Variable value
(d) Constant
108.Editors are used to compile the code.
(a) True
(b) False
109.Which bitwise operator returns false if both bits are 1?
(a) AND
(b) XOR
(c) NOT
(d) OR
110.Structures cannot be passed as Function Parameters
(a) True
(b) False
111.When break statement is encountered in a loop body it,
(a) Transfers the control outside from current loop
(b) Transfers the control outside from current program
(c) Enforces the next iteration of loop
(d) Generates compile time error.
112. A union is a user-defined data type that contains only _______from its list of members at a time.
(a) One object
(b) Two objects
(c) Three objects
(d) None of the given options
113.The size of int data type is
(a) 1 bytes
(b) 2 bytes
(c) 3 bytes
(d) 4 bytes
114.When the logical operator AND (&&) combine two expressions exp1 and exp2 then the result will be true only,
(a) When both exp1 and exp2 are true
(b) When both exp1 and exp2 are false
(c) When exp1 is true and exp2 is false
(d) When exp1 is false and exp2 is true
115.The correct syntax of do-while loop is,
(a) (condition ) while; do { statements; };
(b) { statements; } do-while ();
(c) while(condition); do { statements; };
(d) do { statements; } while (condition);
116._______________ provide communication channels between files and program.
(a) Streams
(b) Language like C++
(c) Function seekg()
(d) None of the above
117.All elements of an array must be of,
(a) different data type
(b) float data only
(c) character data only
(d) same data type
118.Function seekg() takes ____________ parameter(s).
(a) 0
(b) 1
(c) 2
(d) 3
119.Structures help to define program-specific ___________ .
(a) functions
(b) datatypes
(c) Arithmetic operations
(d) None of the given options.
120.In the declaration of two dimensional array,
(a) First index represents row and second represents column
(b) First index represents column and second represents row
(c) Both indexes represent rows
(d) Both indexes represent column
121.What will be the result of arithmetic expression 6+27/3*3?
(a) 33
(b) 45
(c) 9
(d) 30
122.Which of the function call is call by value for the following function prototype? float area (int);
(a) area(&num) ;
(b) area(num) ;
(c) area(int num) ;
(d) area(*num) ;
123.How many bytes are occupied by declaring following array of characters? char str[] = “programming”;
(a) 10
(b) 11
(c) 12
(d) 13
124.Let ptr1 and ptr2 are pointer variables then which of the following arithmetic operation is allowed on pointers?
(a) Addition
(b) Subtraction
(c) Multiplication
(d) All of the above
125.The variables having a name, type and size are just like empty boxes.
(a) True
(b) False
126.When break statement is encountered in a loop body it,
(a) Transfers the control outside from current loop
(b) Transfers the control outside from current program
(c) Enforces the next iteration of loop
(d) Generates compile time error.
127.If two programs a and b are trying to open a file xyz.txt at approximately same time then
(a) Both programs will generate error
(b) One of them will succeed in opening that file and other will fail
(c) Both programs will open the file
(d) One of the program will re-start
128.Q1 The data type of size one byte is
(a) char
(b) int
(c) long
(d) double
129.If Num is an integer variable then Num*= 4; means,
(a) Multiply Num 4 times
(b) Multiply 4 with Num and display
(c) Multiply 4 with Num and assign the result to Num
(d) Add 4 with Num
130.Member function tellg() returns the current location of the _____________ pointer.
(a) tellptr()
(b) write()
(c) seekg()
(d) get()
131.If we want to store a string “abc” in an array str then the size of this array must be at least,
(a) 2
(b) 3
(c) 4
(d) 5
132. Pointer is a variable which store,
(a) Values
(b) Data
(c) Memory Address
(d) Data Type
133.C is widely known as development language of _______ operating system.
(a) Linux
(b) Windows
(c) Unix
(d) Mac OS
134.C++ is a case-sensitive language
(a) True
(b) False
135.What is the output of the following code?
for (int a = 1; a <= 1; a++) cout << a++; cout << a;
(a) 22
(b) 12
(c) 23
(d) 13
136.A continue statement causes execution to skip to
(a)the return 0; statement
(b) the first statement after the loop
(c) the statements following the continue statement
(d) the next iteration of the loop
137.If there is more than one statement in the block of a for loop, which of the
following must be placed at the beginning and the ending of the loop block?
(a) parentheses ( )
(b) braces { }
(c) brackets [ ]
(d) arrows < >
138.What will be the correct syntax for the following function call?
float square (int &);
(a) square (int num);
(b) square (&num);
(c) square (num);
(d) square (*num);
139.Which of the following is the correct way to assign an integer value 5 to element
of a matrix say ‘m’ at second row and third column?
(a) m[2][3] = 5 ;
(b) m[3][2] = 5 ;
(c) m[1][2] = 5 ;
(d) m[2][3] = ‘5’;
140.How many dimensions does n-dimensional array has?
(a) n dimensions
(b) 2n dimensions
(c) (n+1) dimensions
(d) (n-1) dimensions
141.When we declare a multidimensional array the compiler store the elements of
multidimensional array in the form of,
(a) Contiguous memory location
(b) Matrix
(c) Columns
(d) Rows
142.What is function of cout ?
(a) To send data to printer
(b) To read data from keyboard
(c) To display message
(d) To display output on the screen
143.For one byte there are _____ combinations of values that can be stored in
computer.
(A) 2^6
(B) 2^7
C) 2^8
(D) 2^4
144._______________ provide communication channels between files and program.
(a) Streams
(b) Language like C++
(c) Function seekg()
(d) None of the above
145. The data type before a function name represents its,
(a) Return Type
(b) Function data
(c) Function arguments
(d) Function name
146. In C/C++ language when an array is passed to a function then by default its
passing mechanism is,
(a) Call by value
(b) Call by Reference
(c) It depends on type of array
(d) It depends on the return type of function
147.Array is a data structure which store
(a) Memory addresses
(b) Variables
(c) Data Type
(d) Data
148.Which of the following is the correct function call having array named student of
10 elements as a parameter.
(a) addRecord(student[]) ;
(b) addRecord(student) ;
(c) addRecord(student[10]) ;
(d) addRecord(*student) ;
149.What is the difference between = in C as compared to = used in algebra. (5)
ANS In C = sign is used to assigned the value in algebra = sign is show that the both side are equal. In C there must be a variable on the = sign and the right side of the = sign must be a arithmetic expression, variable or a value. In algebra both side of the equation may or may not be expression.
150.What is the difference between switch statement and if statement. (2)
ANS In switch statement only one variable can be tested on various condition but using if we can tested multi variables in single statement.
151.What will be the size of array if we initialize an array with declaration: int arr[] = {0, 0, 0, 0};?
ANS int arr[3];
152.Give a precise definition of function . (1)
ANS Functions In C/C++, functions are a way of modularizing the code. A bigger problem is broken down into smaller and more manageable parts. There is no rule of thumb for the length of each part but normally one function’s length is not more than one screen.
153.Differentiate between C and c++.
ANSWER:-
1. C was the C++ predecessor. As it's name implies, alot of C remains in
C++. Although not actually being more powerful than C.
2. C++ allows the programmer to more easily manage and operate with Objects, using an OOP (Object Oriented Programming) concept
3. C++ allows the programmer to create classes, which are somewhat similar to C structures. However, to a class can be assigned methods, functions associated to it, of various prototypes, which can access and operate within the class, somewhat like C functions often operate on a supplied handler pointer.
4. Although it is possible to implement anything which C++ could implement in C, C++ aids to standardize a way in which objects are created and managed, whereas the C programmer who implements the same system has a lot of liberty on how to actually implement the internals, and style among programmers will vary a lot on the design choices made
5. In C, some will prefer the handler-type, where a main function initializes a handler, and that handler can be supplied to other functions of the library as an object to operate on/through. Others will even want to have that handler link all the related function pointers within it which then must be called using a convention closer to C++.
6 C++ applications are generally slower at runtime, and are much slower to compile than C programs. The low-level infrastructure for C++ binary execution is also larger. For these reasons C is always commonly used even if C++ has alot of popularity, and will probably continue to be used in projects where size and speed are primary concerns, and portable code still required (assembly would be unsuitable then).
154.What is a Linker?
ANS; Linker Most of the time our program is using different routines and functions that are located in different files, hence it needs the executable code of those routines/functions. Linker is a tool which performs this job, it checks our program and includes all those routines or functions which we are using in our program to make a standalone executable code and this process is called Linking
155.How does elements of two-dimensional array store into memory?
ANS:Two dimensional arrays are also stored in liner order. As like one dimensional array.
156.Which strategy is used by binary search algorithm to search a number?
ANS ‘divide and conquer’ strategy is applied.
157.Define Flow chart.
ANS Flow Chart A flow chart is a pictorial representation of a program. There are labeled geometrical symbols, together with the arrows connecting one symbol with other. A flow chart helps in correctly designing the program by visually showing the sequence of instructions to be executed.
158.Why we close a file after use?
ANS To save our data stored on file. Also this process makes our program fast and reliable
159.Suppose there is a pointer to structure *sPtr. How can we access the data member ‘name’ with sPtr?
[1] ANS Structure data members using pointers Using the * operator; (*sptr).name.
160.What is meant by *num and &num?
ANS * num is a pointer and &num is a reference to that pointer.
161.What is meant by scope of identifiers?
ANA;Identifiers appearing outside of any block, function, or function prototype, have file scope. Identifiernames with file scope are often called “global” or “external.” The scope of a global identifier begins at the point of its definition or declaration and terminates at the end of the translation unit.
162.What is difference between single-dimensional and multi-dimensional array?
ANS Single dimentional array used to stored lists and muli dimestional arrays used to stored value as tabler formate i.e matrix.
163.Which bit of the number is used as a sign bit?
ANS The most significant bit is used as a sign bit.
164.What is Overflow condition?
ANS When we try to store larger information in a variable, than a data type can store, overflow condition occurs.
149.What is the difference between = in C as compared to = used in algebra. (5)
ANS In C = sign is used to assigned the value in algebra = sign is show that the both side are equal. In C there must be a variable on the = sign and the right side of the = sign must be a arithmetic expression, variable or a value. In algebra both side of the equation may or may not be expression.
150.What is the difference between switch statement and if statement. (2)
ANS In switch statement only one variable can be tested on various condition but using if we can tested multi variables in single statement.
151.What will be the size of array if we initialize an array with declaration: int arr[] = {0, 0, 0, 0};?
ANS int arr[3];
152.Give a precise definition of function . (1)
ANS Functions In C/C++, functions are a way of modularizing the code. A bigger problem is broken down into smaller and more manageable parts. There is no rule of thumb for the length of each part but normally one function’s length is not more than one screen.
153.Differentiate between C and c++.
ANSWER:-
1. C was the C++ predecessor. As it's name implies, alot of C remains in
C++. Although not actually being more powerful than C.
2. C++ allows the programmer to more easily manage and operate with Objects, using an OOP (Object Oriented Programming) concept
3. C++ allows the programmer to create classes, which are somewhat similar to C structures. However, to a class can be assigned methods, functions associated to it, of various prototypes, which can access and operate within the class, somewhat like C functions often operate on a supplied handler pointer.
4. Although it is possible to implement anything which C++ could implement in C, C++ aids to standardize a way in which objects are created and managed, whereas the C programmer who implements the same system has a lot of liberty on how to actually implement the internals, and style among programmers will vary a lot on the design choices made
5. In C, some will prefer the handler-type, where a main function initializes a handler, and that handler can be supplied to other functions of the library as an object to operate on/through. Others will even want to have that handler link all the related function pointers within it which then must be called using a convention closer to C++.
6 C++ applications are generally slower at runtime, and are much slower to compile than C programs. The low-level infrastructure for C++ binary execution is also larger. For these reasons C is always commonly used even if C++ has alot of popularity, and will probably continue to be used in projects where size and speed are primary concerns, and portable code still required (assembly would be unsuitable then).
154.What is a Linker?
ANS; Linker Most of the time our program is using different routines and functions that are located in different files, hence it needs the executable code of those routines/functions. Linker is a tool which performs this job, it checks our program and includes all those routines or functions which we are using in our program to make a standalone executable code and this process is called Linking
155.How does elements of two-dimensional array store into memory?
ANS:Two dimensional arrays are also stored in liner order. As like one dimensional array.
156.Which strategy is used by binary search algorithm to search a number?
ANS ‘divide and conquer’ strategy is applied.
157.Define Flow chart.
ANS Flow Chart A flow chart is a pictorial representation of a program. There are labeled geometrical symbols, together with the arrows connecting one symbol with other. A flow chart helps in correctly designing the program by visually showing the sequence of instructions to be executed.
158.Why we close a file after use?
ANS To save our data stored on file. Also this process makes our program fast and reliable
159.Suppose there is a pointer to structure *sPtr. How can we access the data member ‘name’ with sPtr?
[1] ANS Structure data members using pointers Using the * operator; (*sptr).name.
160.What is meant by *num and &num?
ANS * num is a pointer and &num is a reference to that pointer.
161.What is meant by scope of identifiers?
ANA;Identifiers appearing outside of any block, function, or function prototype, have file scope. Identifiernames with file scope are often called “global” or “external.” The scope of a global identifier begins at the point of its definition or declaration and terminates at the end of the translation unit.
162.What is difference between single-dimensional and multi-dimensional array?
ANS Single dimentional array used to stored lists and muli dimestional arrays used to stored value as tabler formate i.e matrix.
163.Which bit of the number is used as a sign bit?
ANS The most significant bit is used as a sign bit.
164.What is Overflow condition?
ANS When we try to store larger information in a variable, than a data type can store, overflow condition occurs.
No comments:
Post a Comment