Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

C++ General Interview Questions
Questions Answers Views Company eMail

Which of the following operator cannot be overloaded?

TCL,

2 3811

Consider the following code fragment: int main(void) { int m = 4; mystery ( m ); mystery ( m ); printf("%d", m); return 0; } What is the output on the monitor if mystery is defined as follows ? void mystery (int m) { m = m+3; }

CDAC, Wipro,

2 4353

Write a program to calculate the BMI of a person using the formula BMI = weight/height2.

2 12212

give me some class & objects examples?

1 2751

what is the C++

Wipro,

1 2941

What type of question are asked in GE code writing test based on c++ data structures and pointers?

3352

write a programming using for loop in c++ to generate diamond trangel?

NIIT,

1 7109

Assume studentNames and studentIDs are two parallel arrays of size N that hold student data. Write a pseudocode algorithm that sorts studentIDs array in ascending ID number order such that the two arrays remain parallel.

1550

Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300

1628

write a program that will produce the ff. output. "what fruit will you buy? 1)apple 2)orange 3)mango ENTER CHOICE (1,2 or 3)> HOW MANY WILL YOU BUY?> THAT WILL COST XX.XX

1 2984

Program to check whether a word is a sub-string or not of a string typed

1444

Board Coloring Problem Description In this problem you are given a board in which some of the elements are placed as shown in diagram below. Each element represents a color. Fill the other elements in the board, such that none of the adjacent elements (vertically, horizontally and diagonally) should be of the same color. Find out the minimum number of colors that should be used to fill the blank spaces in the board, so that the above condition is met. Color representation is -: 0, 1, 2, 3, 4, 5, 6, 7……………………. There is sample board: For Example: Given Board : Matrix representation of board is : [ _ 1 _ _ ] [ 2 _ _ _ ] [ _ _ 2 _ ] [ 2 _ _ _ ] here blank space is represented by '_' . Minimum colors to fill this board (given in the picture)is 4. Instruction to work with Open PBT Client: Specify the work directory path in the 'Work directory Path' field. The path should correspond to your solution Work directory. Download the support files by clicking the Get Dev Files. You will find the problem directories containing: problem.h file problem.c file in your project directory. Code the solution in.c file inside the problem directory All required files will be downloaded to your work directory. Creating additional files is strongly discouraged. Step 1: In your Solution File: Implement your logic in function int color(char board[4][4]) char board[4][4]board is 2 dimensional matrix of order M X M where M = 4. You can create more functions if required, but those functions should be in the same file. Step 2: In your solution keep in mind the following constraints. In this problem you have to write a program that finds the minimum number of colors needed to fill a board in which some of the elements are placed in advance. Function color() will take 2 dimension board as a input. Function color() returns the minimum number of colors that could fill the board meeting the given condition. Board is a 2 dimensional of M X M where M = 4 else return 0 Fill the other elements in the board, such that none of the adjacent elements (vertically, horizontally and diagonally) should be of the same color. The Prototype of the function is int color(char board[4][4]) This function takes following arguments. board is 2 dimensional matrix of order M X M where M = 4. This function returns minimum no of color by which board can be filled. The constraints are: Board is a 2 dimensional of M X M where M = 4 else return 0 Fill the other elements in the board, such that none of the adjacent elements (vertically, horizontally and diagonally) should be of the same color. Example 1 Input { 2 0 _ 1 } { _ 1 _ _ } { _ 2 _ 0 } { _ _ _ 1 } Output 5 Explanation: We need a minimum 5 different colors to complete the board. Example 2 Input { 2 0 _ 1 3} { _ 1 _ _ 2} { _ 2 _ 0 1} { _ _ _ 1 2} { _ _ _ _ 0} Output 0 Explanation: Size of the board is greater than 4X4. Example 3 Input { _ 0 } { 1 _ } Output 0 Explanation: Size of the board is less than 4X4. For C solutions Header File : boardcoloring.h Function Name : int color(char board1[4][4]) File Name : boardcoloring.c For C++ solutions Header File : boardcoloring.h Class Name : BoardColoring Function Name : int color(char board1[4][4]) File Name : boardcoloring.c

Infosys,

2525

total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.

1917

Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.

5729

When a function is made inline. Write the situation where inline functions may not work.

2 4969


Post New C++ General Questions

Un-Answered Questions { C++ General }

Reverse the Linked List. Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL

187


What's the best free c++ profiler for windows?

451


Which is most difficult programming language?

406


Is vector a class in c++?

428


What are the differences between the function prototype and the function defi-nition?

444






Will this c++ program execute or not?

443


When should you use global variables?

458


Explain the concept of friend function in c++?

443


What is singleton class in c++?

424


What is pointer to array in c++?

391


What does new return if there is insufficient memory to make your new object?

408


What are the syntactic rules to be avoid ambiguity in multiple inheritance?

460


Why do we use constructor?

406


Describe about storage allocation and scope of global, extern, static, local and register variables?

514


What are structs in c++?

434