Synopsys
10+ Twinkle Stars School Interview Questions and Answers
Q1. you will be given dimensions of a bigger rectangle and smaller rectangle,derive a formula to get how many smaller rectangles fit into the bigger rectangle
Derive a formula to determine how many smaller rectangles fit into a bigger rectangle given their dimensions.
Calculate the number of times the smaller rectangle can fit into the bigger rectangle horizontally and vertically
Divide the width of the bigger rectangle by the width of the smaller rectangle to get the horizontal count
Divide the height of the bigger rectangle by the height of the smaller rectangle to get the vertical count
Multiply the horizontal and vertical counts to...read more
Q2. what will be the new coordinates of a rectangle points if rectangle length and breadth is scaled and write a program to calculate the coordinates of corner points of scaled rectangle
Answering how to calculate new coordinates of a scaled rectangle and providing a program for it.
To calculate new coordinates, multiply the original coordinates by the scaling factor
Scaling factor can be calculated by dividing the new length/breadth by the original length/breadth
Program can take input of original coordinates, scaling factor, and output new coordinates
Example: Original coordinates: (0,0), (0,5), (5,5), (5,0). Scaling factor: 2. New coordinates: (0,0), (0,10), (...read more
Q3. How many points are required to draw a rectangle
At least 4 points are required to draw a rectangle.
A rectangle has 4 sides and 4 corners, so at least 4 points are needed to define those corners.
The points must be arranged in a specific order to form a closed shape with 4 sides.
Additional points can be used to add details or modify the shape of the rectangle.
The number of points required may vary depending on the software or tool used to draw the rectangle.
Q4. where is it necessary to use references
References are necessary when passing large objects to functions or when returning objects from functions.
When passing large objects to functions
When returning objects from functions
When working with complex data structures
When implementing operator overloading
When working with polymorphism
Q5. where to declare const pointers
Const pointers should be declared in the same scope as the variable they point to.
Declaring const pointers in the same scope as the variable they point to ensures that the pointer cannot be used to modify the variable.
If the pointer is only used within a function, it should be declared within that function.
If the pointer is used across multiple functions, it should be declared in a header file or at the top of the source file.
Examples: const int* ptr = &variable; const MyClas...read more
Q6. 1.given a large rectangle
Need more context. What needs to be done with the large rectangle?
What are the dimensions of the rectangle?
Is it a 2D or 3D object?
What is the context of the problem?
Are there any constraints or limitations?
What tools or programming languages can be used?
Q7. Identify if the number is positive, negative or zero
Identify if a number is positive, negative, or zero
Check if the number is greater than 0 to determine if it is positive
Check if the number is less than 0 to determine if it is negative
If the number is neither greater nor less than 0, it is zero
Q8. References vs pointers
References and pointers are both used to refer to memory locations, but references cannot be null and cannot be reseated.
Pointers can be null or uninitialized
Pointers can be reseated to point to a different memory location
References are automatically dereferenced
References cannot be used with arrays
Pointers can be used with arrays
Q9. Copy constructor with pointers
Copy constructor with pointers creates a new object by copying the values of the existing object's pointers.
Copy constructor is used to create a new object from an existing object.
Pointers in the new object point to the same memory locations as the original object.
Deep copy should be used to avoid shallow copy issues.
Q10. new vs malloc
new and malloc are used for dynamic memory allocation in C++ and C respectively.
new is an operator in C++ while malloc is a function in C.
new automatically calls the constructor while malloc does not.
new returns a pointer to the object while malloc returns a void pointer.
new throws an exception if allocation fails while malloc returns NULL.
new can be overloaded while malloc cannot be.
new and delete are used together while malloc and free are used together.
More about working at Synopsys
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month