Quiz-1

Question 1

Time: 00:00:00
The library function used to find the last occurrence of a character in a string is

strnstr()

strnstr()

laststr()

laststr()

strrchr()

strrchr()

strstr()

strstr()

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

D

Start

Question 2

Time: 00:00:00
Identify which of the following are declarations
1 : extern int x;
2 : float square ( float x ) { ... }
3 : double pow(double, double);

1

1

2

2

3

3

1 & 3

1 & 3

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Which of the following statements are correct about an array?

1: The array int num[26]; can store 26 elements.

2: The expression num[1] designates the very first element in the array.

3: It is necessary to initialize the array at the time of declaration.

4: The declaration num[SIZE] is allowed if SIZE is a macro.

1

1

1,4

1,4

2,3

2,3

2,4

2,4

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
Predict the output

#include<stdio.h>
void fun(int **p);

int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0};
int *ptr;
ptr = &a[0][0];
fun(&ptr);
return 0;
}
void fun(int **p)
{
printf("%d\n", **p);
}

1

1

2

2

3

3

4

4

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Explanation: Step 1: int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0}; The variable a is declared as an multidimensional integer array with size of 3 rows 4 columns. Step 2: int *ptr; The *ptr is a integer pointer variable. Step 3: ptr = &a[0][0]; Here we are assigning the base address of the array a to the pointer variable *ptr. Step 4: fun(&ptr); Now, the &ptr contains the base address of array a. Step 4: Inside the function fun(&ptr); The printf(\"%d\\n\", **p); prints the value \'1\'. because the *p contains the base address or the first element memory address of the array a (ie. a[0]) **p contains the value of *p memory location (ie. a[0]=1). Hence the output of the program is \'1\'

Start

Question 5

Time: 00:00:00
What will be the output of the program if the array begins at address 65486?

#include<stdio.h>
int main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u\n", arr, &arr);
return 0;
}

65486, 65486

65486, 65486

65486, 65488

65486, 65488

65486, 65490

65486, 65490

65486, 65487

65486, 65487

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What will be the output of the program?

#include<stdio.h>

int main()
{
char ch;
ch = 'A';
printf("The letter is ");
printf("%c", ch >= 'A' && ch <= 'Z' ? ch + 'a' - 'A':ch);
printf("\nNow the letter is ");
printf("%c\n", ch >= 'A' && ch <= 'Z' ? ch : ch + 'a' - 'A');
return 0;
}

Error

Error

The letter is A Now the letter is a

The letter is A Now the letter is a

The letter is a Now the letter is A

The letter is a Now the letter is A

None of the mentioned

None of the mentioned

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
What will be the output of the program?

#include<stdio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j && ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
}

 

-2, 3, 1, 1

-2, 3, 1, 1

2, 3, 1, 2

2, 3, 1, 2

1, 2, 3, 1

1, 2, 3, 1

3, 3, 1, 2

3, 3, 1, 2

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What will be the output of the program?

#include<stdio.h>
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w = i || j || k;
x = i && j && k;
y = i || j &&k;
z = i && j || k;
printf("%d, %d, %d, %d\n", w, x, y, z);
return 0;
}

1, 1, 1, 1

1, 1, 1, 1

1, 1, 0, 1

1, 1, 0, 1

1, 0, 1, 1

1, 0, 1, 1

1, 0, 0, 1

1, 0, 0, 1

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What will be the output of the program?


#include<stdio.h>
int main()
{
int i=3;
i = i++;
printf("%d\n", i);
return 0;
}

3

3

4

4

5

5

6

6

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
Consider following given the code and predict its output

#include<stdio.h>

int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}

2, 1, 15

2, 1, 15

1, 2, 5

1, 2, 5

3, 2, 15

3, 2, 15

2, 3, 20

2, 3, 20

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice! \r\n","Keep trying! \r\n","Not bad! \r\n","Good work! \r\n","Perfect! \r\n"]

Buy Capgemini Pseudo Code Paid Materials

Join Capgemini Online Classes

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/10

Accuracy

0%

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects