C and C++ Programming Fundamentals
Test your knowledge of C and C++ programming concepts including operators, arrays, functions, classes, constructors, variables, and compilation basics
Questions
What will be output if you will execute following c code?
- 6
- 7
- 8
- 9
- CompilationError
What will be output if you will Execute following c code?
- 5,4
- -4,4
- -5,4
- -4,5
- Compilation Error
We need to have a structure day of type date which has the following values. date day = {17,2,2011}; Will the following Structured Declaration Correct?
- True
- False
Which of the following statements are correct?
- Relational and equality operators evaluate their operands to produce a true or false result.
- The equality operators have the same level of precedence And associate right to left.
- Relational operators all have the same level of precedence And associate right to left.
- The precedence of relational operators is at a lower level Than the precedence of the equality operators.
Which of the following will occur when trying to validate the below code Segment?
- Syntax Error
- Linker Error
- Runtme Error
- No Error, It will be run successfully
setprecision requires the header file
- stdlib.h
- iomanip.h
- console.h
- conio.h
If char catname[15]; , which of the following is valid?
- catname[15] = "Millie";
- catname = "Millie";
- catname[ ] = "Millie";
- None are Valid
Variables with names that describe the data Stored at that particular memory location are called as
- identifiers
- constant variables
- floating point variables
- mnemonic variables
The other name for external variables in C++ is
- static variables
- register variables
- global variables
- None of the Above
Class that reads and writes to an array in memory is
- ostream
- ifstream
- strstream
- None of the Above
Can a copy constructor accept an object of the same class as parameter, instead of reference of the object?
- True
- False
What is the value of x when the below code segment is executed?
- 10
- 20
- Compilation Error
- RuntimeError
What happens when the following code segment is Validated?
- Complies Successfully
- Error Due to Duplicate Variables.
- RunTime Error
- Executes Successfully
Which of the following statements are correct about Function prototypes?
- It resembles the header Of the function definition
- It tells the compiler the Names of the parameters
- It must be declared before its corresponding functions can be utilized
- All the above are incorrect
What the following program is executed?
- CompilationFails
- Will Throw RunTime Error But Code will get Compiled
- Throws Linker Error
- All the above statements are invalid
Using pointers to call a function is called as
- call by value
- call by reference
- call by address
- All the Above
The member functions of a class can be defined outside the Class using
- Extraction Operator
- Insertion Operator
- Scope resolution operator
- None of the Above
Which of the following will occur when trying to validate the below code Segment? #define <iostream.h> #define <GetSquareOfx.hpp> // GetSquareOfx function-prototype has the following defn // int GetSquareOfx(int) ; Int main() { int x =5 ; Cout << GetSquareOfx() ; return x ; }
- Syntax Error
- Linker Error
- Runtme Error
- No Error, It will be run successfully
What will be output if you will execute following c code? #include<stdio.h> #include<conio.h> void main() { int a[]={0,1,2,3,4,5,6,7,8,9,10}; int i=0,num; num=a[++i+a[++i]]+a[++i]; printf("%d",num); }
- 6
- 7
- 8
- 9
- CompilationError
What will be output if you will Execute following c code? #include<stdio.h> int main() { int num,a=5; num=-a--; printf("%d %d",num,a); }
- 5,4
- -4,4
- -5,4
- -4,5
- Compilation Error