Beruflich Dokumente
Kultur Dokumente
3. C can be used on
A) Only MS-Dos operating System
B) Only Linux operating system
C) Only Windows operating system
D) All of the above
6. Array is
A) Primary data type
B) Pointer data type
C) Heterogeneous data type
D) Homogenous data type
Answers:
1. C) Dennis Ritche
2. B) 8
3. D) All of the above
4. C) 15
5. B) A complier
6. D) Homogenous data type
7. C) ( )
8. A) Loop
9. D) 2
10. B) Address of variable
A) DOS
B) Windows
C) Unix
A) Keywords
B) Variables
C) Constraints
A) 1970
B) 1972
C) 1976
D) 1980
A) \a
B) \b
C) \m
D) \n
B) external
C) auto
D) scanf
A) streams.h
B) stdio.h
C) stdlib.h
D) files.h
8. A compiler ................
A) is a computer program
C) is a part of software
D) editor
A) casting
B) conversion
C) disjunction
D) separation
10. A function popularly used C input function
A) scanf
B) printf
C) getch
D) Char
76. Answers:
77.
A) 1970
B) \b
C) auto
B) stdio.h
78.
8. A compiler ................
A) scanf
C) Assembly language
A) #
B) include
C) main()
D) {
3. C allows arrays of greater than two dimensions, who will determine this?
A) programmer
B) compiler
C) parameter
A) Right shifting
B) Left shifting
C) Bitwise shifting
D) Bitwise complement
5. Set of values of the same type, which have a single name followed by an index is called
A) function
B) structure
C) array
D) union
A) String.h
B) Strings.h
C) file.h
D) strcpy()
A) double character
B) single character
C) multiple characters
D) no character
A) Static variable
B) auto variable
C) external variable
D) local variable
9. In the loop structure logical expression is checked at the ....................of the loop.
A) first
B) end
C) middle
D) second
10. If an array is used as function argument, the array is passed
A) by value
B) by reference
C) by name
12. Which escape character can be used to begin a new line in C ........
A) \a
B) \m
C) \b
D) \n
13. Input/output function prototypes and macros are defined in which header file?
A) conio.h
B) stdlib.h
C) stdio.h
D) dos.h
Answers:
A) #
3. C allows arrays of greater than two dimensions, who will determine this?
B) compiler
B) Left shifting
5. Set of values of the same type, which have a single name followed by an index is called
C) array
A) String.h
D) local variable
9. In the loop structure logical expression is checked at the ....................of the loop.
A) first
B) by reference
12. Which escape character can be used to begin a new line in C ........
D) \n
13. Input/output function prototypes and macros are defined in which header file?
C) stdio.h
1. What will be output of the following C program? #include int main() {int goto=5; printf("%d",goto); return
0;}
A) 5
B) 10
C) **
D) compilation error
2. Output of the following C program fragment is. x=5; y=x++; printf("%d %d", x,y);
A) 5, 6
B) 5, 5
C) 6, 5
D) 6, 6
3. What will be output of the following C program? #include int xyz=10; int main() { int xyz=20; printf("%d",
xyz); return 0;}
A) 10
B) 20
C) 30
D) compilation error
B) Prints 0
C) Is an error
D) In an infinite loop
5. What will be output of the following program? #include int main() {int a=2, b=7, c=10; c=a==b;
printf("%d",c); return 0;}
A) 0
B) 7
C) 10
D) 2
6. What is the output of the following program segment? main( ) { long i=65536; printf("%d\n", i); }
A) 0
B) 65536
C) -1
D) 65
7. What will be the output of the program? # include int main() {int a[5]={5,1,15,20,25}; int i, j, m; i=++a[1];
j=a[1]++; m=a[i++]; printf("%d, %d, %d", i,j,m); return0;}
A) 2, 1, 15
B) 1, 2, 5
C) 3, 2, 15
D) 2, 3, 20
8. What is the output of the following program segment? main( ) { int=1; do { printf("%d . . ", i); } while (i--); }
A) 0 . . 1 . .
B) 1 . . 0 . .
C) 0
D) -1
A) 1
B) 0
C) -1
D) Null
10. What will be the output of the following program? main( ) { int i=5; printf("%d", i=++i==6); }
A) 0
B) 7
C) 6
D) 1
Answers:
1. What will be output of the following C program? #include int main() {int goto=5; printf("%d",goto); return
0;}
A) 5
2. Output of the following C program fragment is. x=5; y=x++; printf("%d %d", x,y);
C) 6, 5
3. What will be output of the following C program? #include int xyz=10; int main() { int xyz=20; printf("%d",
xyz); return 0;}
B) 20
5. What will be output of the following program? #include int main() {int a=2, b=7, c=10; c=a==b;
printf("%d",c); return 0;}
A) 0
6. What is the output of the following program segment? main( ) { long i=65536; printf("%d\n", i); }
A) 0
7. What will be the output of the program? # include int main() {int a[5]={5,1,15,20,25}; int i, j, m; i=++a[1];
j=a[1]++; m=a[i++]; printf("%d, %d, %d", i,j,m); return0;}
C) 3, 2, 15
8. What is the output of the following program segment? main( ) { int=1; do { printf("%d . . ", i); } while (i--); }
B) 1 . . 0 . .
B) 0
10. What will be the output of the following program? main( ) { int i=5; printf("%d", i=++i==6); }
D) 1
A) !
B) ~
C) #
D) ;
2. If the size of the array is less than the number of initializes then, ..........
4. How many times the following loop be executed? { .. ch='b'; while (ch>='a' && ch<=='z') ch++; }
A) 0
B) 25
C) 26
D) 1
A) assigns a value 8 to x
C) assigns a value 15 to x
D) assigns a value 7 to x
6. What is the output of the following code. int n=0, m=1; do { printf("%d", m); m++; } while (m<=n);
A) 0
B) 2
C) 1
D) 4
7. A C program contains the following declaration int i=8, j=5 what would be the value of following
expression? abs(i-2*j)
A) 2
B) 4
C) 6
D) 8
A) 75
B) 75%%
C) 75%
9. How many times the following program would print ("abc")? main( ) { printf("\nabc"); main( ); }
B) 32767 times
C) 65535 times
10. Which of the following is the correct usage of conditional operators used in C?
A) a>b?c=30:c=40;
B) a>b?c=30;
C) max=a>b?a>c?a:c:b>c?b:c
D) return (a>b)?(a:b)
Answers:
D) ;
2. If the size of the array is less than the number of initializes then, ..........
4. How many times the following loop be executed? { .. ch='b'; while (ch>='a' && ch<=='z') ch++; }
B) 25
C) assigns a value 15 to x
6. What is the output of the following code. int n=0, m=1; do { printf("%d", m); m++; } while (m<=n);
C) 1
7. A C program contains the following declaration int i=8, j=5 what would be the value of following
expression? abs(i-2*j)
A) 2
9. How many times the following program would print ("abc")? main( ) { printf("\nabc"); main( ); }
C) max=a>b?a>c?a:c:b>c?b:c
1. There is a unique function in C++ program by where all C++ programs start their execution with ........
A) start()
B) begin()
C) main()
D) output()
A) break
B) Goto
C) Exit
D) Switch
A) floor address
B) foundation address
C) first address
D) base address
A) Four
B) Three
C) Two
A) Executed
B) Handled appropriately
C) Resolved
6. After defining the function template, the next step to call it in another function such as .........
A) int()
B) secondary()
C) template()
D) main()
8. .................. are one of the attributes of C++ that support run-time polymorphism.
A) Pointers
B) Derived classes
C) Virtual functions
D) Heap tree
B) string
C) sstring
D) sstream
A) c++;
B) c=c+1;
C) c+1=>c;
D) c+=1;
Answers:
1. There is a unique function in C++ program by where all C++ programs start their execution with ........
C) main()
D) Switch
D) base address
B) Three
B) Handled appropriately
6. After defining the function template, the next step to call it in another function such as .........
D) main()
7. A file stream refers to the flow of data between a ...............
8. .................. are one of the attributes of C++ that support run-time polymorphism.
C) Virtual functions
C) sstring
C) c+1=>c;
3. The ...................... objects have values that can be tested for various error conditions.
A) osstream
B) ofstream
C) stream
D) ifstream
4. Which function return the current position of the get or put pointer in bytes.
A) tellg( )
B) tellp( )
C) tell( )
D) Both A and B
5. The first index number in an array starts with ............................ and the index number of an array of size n
will be ............
A) 0, n-1
B) 1, n-1
C) 0, n
D) 1, n
6. To overload an operator ..................... keyword must be used along with the operator to be overloaded.
A) Over
B) Overload
C) Void
D) Operator
void main()
{
int n=1;
cout<<endl<<"The numbers are;"<<endl;
do
{
cout <<n<<"\t";
n++;
} while (n<=100);
cout <<endl;
}
8. Everything defined at the program scope level (ie. outside functions and classes) is said to be ...............
A) local scope
B) regional scope
C) global scope
D) static scope
9. Because the lifetime of a local variable is limited and determined automatically, these variables are also
called ............................
A) automator
B) automatic
C) dynamic
D) static
10. ................ allows that a section of a program is compiled only if the defined constant that is specified as the
parameter has been defined, independently of its value.
A) #ifdef
B) #if
C) #define
D) #ifd
Answers
1. C) New
2. C) : :
3. D) ifstream
4. B) tellp( )
5. A) 0, n-1
6. D) Operator
7. D) Print natural numbers 1 to 100
8. C) global scope
9. B) automatic
10. A) #ifdef
5. Which of the following is true about the static member variable in C++.
i) It is initialized to zero when the first object of its class is created. Other initialization is also permitted.
ii) It is visible only within the class, but its lifetime is the entire program.
A) i-True, ii-True
B) ii-False, ii-True
C) i-True, ii-False
D) i-False, iii-False
6. Which of the following keywords are used to control access to a class member?
A) default
B) break
C) protected
D) goto
7. What will be the values of x, m and n after execution of the following statements?
Int x, m, n;
m=10;
n=15;
x= ++m + n++;
A) x=25, m=10, n=15
B) x=27, m=10, n=15
C) x=26, m=11, n=16
D) x=27, m=11, n=16
9. A variable is defined within a block in a body of a function. Which of the following are true?
A) It is visible throughout the function.
B) It is visible from the point of definition to the end of the program.
C) It is visible from the point of definition to the end of the block.
D) It is visible throughout the block.
Answers
1. C) Inline function
2. D) Header files
3. C) False, True
4. B) +
5. B) ii-False, ii-True
6. C) protected
7. C) x=26, m=11, n=16
8. C) To facilitate the reusability of code
9. D) It is visible throughout the block.
10. A) We want to exchange … classes