Qualcomm Interview Question for Software Developers


Country: United States
Interview Type: Written Test




Comment hidden because of low score. Click to expand.
1
of 1 vote

/* To compile use -lm flag */
#include<complex.h>
#include<stdio.h>
#include<math.h>
typedef _Complex float cf_t;

#define PSS_LEN 62

/**
* This function calculates the Zadoff-Chu sequence.
* @param signal Output array.
*/
/* Orig int pss_generate(cf_t *signal, uint32_t N_id_2) */
int pss_generate(cf_t *signal, int N_id_2)
{
int i;

float arg;
const float root_value[] = { 25.0, 29.0, 34.0 };
int root_idx;

int sign = -1;
if (N_id_2 > 2)
{
printf("Error\n");
//fprintf(stderr, "Invalid N_id_2 %d\n", N_id_2);
return -1;
}

root_idx = N_id_2;
for (i = 0; i < PSS_LEN / 2; i++)
{
arg = (float) sign * M_PI * root_value[root_idx] * ((float) i * ((float) i + 1.0)) / 63.0;
__real__ signal[i] = cosf(arg);
__imag__ signal[i] = sinf(arg);
}


for (i = PSS_LEN / 2; i < PSS_LEN; i++){
arg = (float) sign * M_PI * root_value[root_idx]* (((float) i + 2.0) * ((float) i + 1.0)) / 63.0;
__real__ signal[i] = cosf(arg);
__imag__ signal[i] = sinf(arg);
}

return 0;
}
int main()
{
cf_t pss_signal[PSS_LEN];
pss_generate(pss_signal,1);
}

- Anonymous November 28, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

/* To compile use -lm flag */
#include<complex.h>
#include<stdio.h>
#include<math.h>
typedef _Complex float cf_t;

#define PSS_LEN 62

/**
* This function calculates the Zadoff-Chu sequence.
* @param signal Output array.
*/
/* Orig int pss_generate(cf_t *signal, uint32_t N_id_2) */
int pss_generate(cf_t *signal, int N_id_2){
int i;

float arg;
const float root_value[] = { 25.0, 29.0, 34.0 };
int root_idx;

int sign = -1;
if (N_id_2 > 2) {
printf("Error\n");
//fprintf(stderr, "Invalid N_id_2 %d\n", N_id_2);
return -1;
}

root_idx = N_id_2;
for (i = 0; i < PSS_LEN / 2; i++) {
arg = (float) sign * M_PI * root_value[root_idx] * ((float) i * ((float) i + 1.0)) / 63.0;
__real__ signal[i] = cosf(arg);
__imag__ signal[i] = sinf(arg);
}


for (i = PSS_LEN / 2; i < PSS_LEN; i++){
arg = (float) sign * M_PI * root_value[root_idx]* (((float) i + 2.0) * ((float) i + 1.0)) / 63.0;
__real__ signal[i] = cosf(arg);
__imag__ signal[i] = sinf(arg);
}

return 0;
}
int main(){
cf_t pss_signal[PSS_LEN];
pss_generate(pss_signal,1);
}

- subhraprakash79 November 28, 2017 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More