Get free ebooK with 50 must do coding Question for Product Based Companies solved
Fill the details & get ebook over email
Thank You!
We have sent the Ebook on 50 Must Do Coding Questions for Product Based Companies Solved over your email. All the best!

Cognizant GenC Interview Questions – Set-2(Technical Interview Questions)

Last Updated on October 10, 2022 by Gokul Kannan

Cognizant is a multinational technology company based in the United States specializing in business consulting, information technology, and outsourcing. The company’s headquarters are in Teaneck, New Jersey. Cognizant is a member of the NASDAQ-100, S&P 500, Forbes Global 2000, and Fortune 500, and is one of the world’s most successful and fastest-growing organizations.
Cognizant assists businesses in modernizing technology, reimagining processes, and transforming customer experiences to stay ahead in an ever-changing environment. It is determined to enhance the way the world works via technology, whether it’s by altering the companies that the world relies on or by providing the tools and flexibility you need to develop the best you. Cognizant specializes in information technology, information security, consulting, ITO, and BPO services. Cognizant’s business is divided into three areas: digital business, digital operations, and digital systems and technology. Cognizant GenC Interview Questions are easy to understand for an intermediate candidate. Let’s Discuss some Cognizant GenC interview Questions (Technical Round).

15 Technical Questions Asked in Cognizant GenC Interview Questions

1. What is the difference between a pre-increment operator and a post-increment operator?

The Pre-increment operator is used to increment the variable value by one before assigning the cost to the variable. Post-increment operators increment the variable value by one after assigning the value to the variable.

2. How are linked lists more efficient than arrays?

A linked list is more efficient than arrays in the following ways:
For insertion and deletion, we only need to update the address present in the next pointer of a node.
No need to provide an initial size during the time of creation since it can grow and shrink at runtime by allocating and deallocating memory.
No memory is wasted since it is allocated during the runtime.

3. What is a modifier in C?

Modifiers derive the space to allocate for a variable.
Modifiers are fixed with basic data types to modify (either increase or decrease) the amount of storage allocated to a variable.
For example, storage requirements for int data type are 4 bytes for a 32-bit processor. We can increase range by using long int data type which is 8 bytes. We can decrease the range by using a short int which is 2 bytes.

4. What are virtual Functions?

In object-oriented programming, in languages such as C++, and Object Pascal, a virtual function or virtual method is an inheritable and overridable function or method for which dynamic dispatch is facilitated. This concept is an essential part of the (runtime) polymorphism portion of object-oriented programming (OOP).

5. What is overloading in OOPs?

Overloading is a process to avoid redundant code where the same method name is used multiple times but with a different set of parameters. The actual method that gets called during runtime is resolved at compile time, thus avoiding runtime errors.

6. What is overriding?

In object-oriented programming, Overriding is a process that allows a child class or subclass to provide a specific implementation of functions already provided by one of its superclasses or parent classes.

7. What is the fill factor in SQL? What is its default value?

The fill factor is the percentage of space on each leaf-level page that will be filled with data. The smallest unit in SQL Server is a page, which is made up of 8K pages. Depending on the size of the row, each page can store one or more rows. The Fill Factor’s default value is 100, which is the same as the value 0. The SQL Server will fill the leaf-level pages of an index with the highest number of rows it can fit if the Fill Factor is set to 100 or 0. When the fill factor is 100, the page will have no or very little vacant space.

8. What exactly is index hunting, and how does it aid query performance?

Index hunting is the method of boosting a collection of indexes. This is done because indexes improve query performance as well as query processing time.
It aids in query performance improvement in the following ways:

  • Using the query optimizer, the optimal queries are suggested.
  • To check the effect, parameters such as index, query distribution, and performance are used.
  • Databases are optimized into a small group of problem queries.

9. Write the code to find the length of a string without using the string functions.

#include <iostream>
using namespace std;
int main()
{
      char str[100];
      int len = 0;
      cout << "Enter a string: ";
      cin >> str;
      while(str[len] != '\0')
      {
             len++;
      }
      cout << "Length of the given string is: " << len;
      cout << endl;
      return 0;
}

10. How will you print the address of a variable without using a pointer?

#include <stdio.h>
int main(void)
{
   int x;
   float y;
   char z;
   printf("Address of x: %p\n", &x);
   printf("Address of y: %p\n", &y);
   printf("Address of z: %p\n", &z);
   return 0;
}

11. Write a program to print the following pattern.

#include <iostream>
using namespace std;

void pypart(int n)
{
	for (int i = 0; i < n; i++) {

		for (int j = 0; j <= i; j++) {

			cout << "* ";
		}

		cout << endl;
	}
}

int main()
{
	int n = 5;
	pypart(n);
	return 0;
}

12. Write a program to print the following pattern.

#include <iostream>
using namespace std;

void triangle(int n)
{
	int k = 2 * n - 2;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < k; j++)
			cout << " ";
		k = k - 1;
		for (int j = 0; j <= i; j++) {
			cout << "* ";
		}
		cout << endl;
	}
}

int main()
{
	int n = 5;

	triangle(n);
	return 0;
}

13. Write a program to print the following pattern.

def num(n):
	num = 1
	for i in range(0, n):
		num = 1
		for j in range(0, i+1):
			print(num, end=" ")
			num = num + 1
		print("\r")
n = 5
num(n)

14. Write a program to print the following pattern.

#include <iostream>
using namespace std;

void numpat(int n)
{
	int num = 1;

	for (int i = 0; i < n; i++) {
		
		num = 1;
		
		for (int j = 0; j <= i; j++) {

			cout << num << " ";
			num = num + 1;
		}

		cout << endl;
	}
}

int main()
{
	int n = 5;

	numpat(n);
	return 0;
}

15. Write a program to print the following pattern.

#include <iostream>
using namespace std;

void contalpha(int n)
{
	int num = 65;

	for (int i = 0; i < n; i++) {

		for (int j = 0; j <= i; j++) {
			char ch = char(num);
			cout << ch << " ";
			num = num + 1;
		}
		cout << endl;
	}
}

int main()
{
	int n = 5;

	contalpha(n);
	return 0;
}

We tried to discuss the Technical Cognizant GenC Interview Questions. We hope this article gives you a better understanding of Cognizant GenC Interview Questions. Prepbytes also provides a good collection of Foundation Courses that can help you enhance your coding skills. Want to make sure you ace the interview in one go? Join our Placement Program that will help you get prepared and land your dream job at MNCs. Mentors of Prepbytes are highly experienced and can provide you with basic, in-depth subject knowledge for better understanding.

Leave a Reply

Your email address will not be published. Required fields are marked *