Search Header Logo

PIC 2024

Authored by prapulla shivraj

Computers

University

PIC 2024
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

13 questions

Show all answers

1.

FILL IN THE BLANK QUESTION

1 min • 1 pt

#include <stdio.h>

struct School

{ int age, rollNo; };

void solve()

{ struct School sc; sc.age = 19; sc.rollNo = 82; printf("%d", (int)sizeof(sc)); }

int main()

{ solve();

return 0; }

2.

FILL IN THE BLANK QUESTION

1 min • 1 pt

#include <stdio.h> #include<string.h> void sol() { char s[] = "Hello"; printf("%s ", s); char t[40]; strcpy(t, s); printf("%s", t); } int main() { sol(); return 0; }

3.

FILL IN THE BLANK QUESTION

1 min • 1 pt

#include <stdio.h> #include<stdlib.h> void set(int to) { to = (int)malloc(5 sizeof(int)); } void solve() { int ptr; set(ptr); ptr = 10; printf("%d", ptr); } int main() { solve(); return 0; }

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

#include <stdio.h> int search(int l, int r, int target, int a[]) { int mid = (l + r) / 2; if(a[mid] == target) { return mid; } else if(a[mid] < target) { return search(mid + 1, r, target, a); } else { return search(0, mid - 1, target, a); } } void binsearch() { int a[] = {1, 2, 3, 4, 5}; printf("%d", search(0, 5, 3, a)); } int main() { binsearch(); return 0; }

0

2

4

1

5.

FILL IN THE BLANK QUESTION

1 min • 1 pt

#include <stdio.h> int get(int n) { if(n <= 1) { return n; } return get(n - 1) + get(n - 2); } void solve() { int ans = get(6); printf("%d", ans); } int main() { solve(); return 0; }

6.

FILL IN THE BLANK QUESTION

1 min • 1 pt

#include <stdio.h> void solve(int x) { if(x == 0) { printf("%d ", x); return; } printf("%d ", x); solve(x - 1); printf("%d ", x); } int main() { solve(3); return 0; }

a) 3 2 1 0 1 2 3

b) 3 2 1 0

c) 0 1 2 3

d) None of the above


7.

FILL IN THE BLANK QUESTION

1 min • 1 pt

#include <stdio.h> #define VAL 5 int getInput() { return VAL; } void solve() { const int x = getInput(); printf("%d", x); } int main() { solve(); return 0; }

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?